| Asterisk - The Open Source Telephony Project GIT-master-27fb039
    | 
#include "asterisk.h"#include "asterisk/astobj2.h"#include "asterisk/datastore.h"#include "asterisk/channel.h"#include "asterisk/res_geolocation.h"#include "asterisk/vector.h"#include "geoloc_private.h"
Go to the source code of this file.
| Data Structures | |
| struct | eprofiles_datastore | 
| struct | eprofiles_datastore::geoloc_eprofiles | 
| Macros | |
| #define | GEOLOC_DS_TYPE "geoloc_eprofiles" | 
| #define | IS_GEOLOC_DS(_ds) (_ds && _ds->data && ast_strings_equal(_ds->info->type, GEOLOC_DS_TYPE)) | 
| Functions | |
| int | ast_geoloc_datastore_add_eprofile (struct ast_datastore *ds, struct ast_geoloc_eprofile *eprofile) | 
| Add an eprofile to a datastore. | |
| struct ast_datastore * | ast_geoloc_datastore_create (const char *id) | 
| Create an empty geoloc datastore. | |
| struct ast_datastore * | ast_geoloc_datastore_create_from_eprofile (struct ast_geoloc_eprofile *eprofile) | 
| Create a geoloc datastore from an effective profile. | |
| struct ast_datastore * | ast_geoloc_datastore_create_from_profile_name (const char *profile_name) | 
| Geolocation datastore Functions. | |
| int | ast_geoloc_datastore_delete_eprofile (struct ast_datastore *ds, int ix) | 
| Delete a specific eprofile from a datastore by index. | |
| struct ast_datastore * | ast_geoloc_datastore_find (struct ast_channel *chan) | 
| Retrieves the geoloc datastore from a channel, if any. | |
| struct ast_geoloc_eprofile * | ast_geoloc_datastore_get_eprofile (struct ast_datastore *ds, int ix) | 
| Retrieve a specific eprofile from a datastore by index. | |
| const char * | ast_geoloc_datastore_get_id (struct ast_datastore *ds) | 
| Retrieve a geoloc datastore's id. | |
| int | ast_geoloc_datastore_insert_eprofile (struct ast_datastore *ds, struct ast_geoloc_eprofile *eprofile, int index) | 
| Insert an eprofile to a datastore at the specified position. | |
| int | ast_geoloc_datastore_set_inheritance (struct ast_datastore *ds, int inherit) | 
| Sets the inheritance flag on the datastore. | |
| int | ast_geoloc_datastore_size (struct ast_datastore *ds) | 
| Retrieves the number of eprofiles in the datastore. | |
| int | geoloc_channel_load (void) | 
| int | geoloc_channel_reload (void) | 
| int | geoloc_channel_unload (void) | 
| static void * | geoloc_datastore_duplicate (void *obj) | 
| static void | geoloc_datastore_free (void *obj) | 
| Variables | |
| static const struct ast_datastore_info | geoloc_datastore_info | 
| struct ast_sorcery * | geoloc_sorcery | 
| #define GEOLOC_DS_TYPE "geoloc_eprofiles" | 
Definition at line 27 of file geoloc_datastore.c.
| #define IS_GEOLOC_DS | ( | _ds | ) | (_ds && _ds->data && ast_strings_equal(_ds->info->type, GEOLOC_DS_TYPE)) | 
Definition at line 84 of file geoloc_datastore.c.
| int ast_geoloc_datastore_add_eprofile | ( | struct ast_datastore * | ds, | 
| struct ast_geoloc_eprofile * | eprofile | ||
| ) | 
Add an eprofile to a datastore.
| ds | The datastore | 
| eprofile | The eprofile to add. | 
Definition at line 135 of file geoloc_datastore.c.
References ao2_bump, ao2_ref, ast_log, AST_VECTOR_APPEND, AST_VECTOR_SIZE, ast_datastore::data, eprofiles_datastore::eprofiles, ast_geoloc_eprofile::id, eprofiles_datastore::id, IS_GEOLOC_DS, LOG_ERROR, and NULL.
Referenced by add_eprofile_to_channel(), ast_geoloc_datastore_create_from_eprofile(), ast_geoloc_datastore_create_from_profile_name(), and geoloc_profile_write().
| struct ast_datastore * ast_geoloc_datastore_create | ( | const char * | id | ) | 
Create an empty geoloc datastore.
| id | An id to use for the datastore. | 
Definition at line 99 of file geoloc_datastore.c.
References ast_calloc, ast_datastore_alloc, ast_datastore_free(), ast_log, ast_strlen_zero(), AST_VECTOR_INIT, ast_datastore::data, eprofiles_datastore::eprofiles, geoloc_datastore_info, LOG_ERROR, and NULL.
Referenced by add_eprofile_to_channel(), ast_geoloc_datastore_create_from_eprofile(), ast_geoloc_datastore_create_from_profile_name(), and geoloc_profile_write().
| struct ast_datastore * ast_geoloc_datastore_create_from_eprofile | ( | struct ast_geoloc_eprofile * | eprofile | ) | 
Create a geoloc datastore from an effective profile.
| eprofile | The effective profile to use. | 
Definition at line 242 of file geoloc_datastore.c.
References ast_datastore_free(), ast_geoloc_datastore_add_eprofile(), ast_geoloc_datastore_create(), ast_geoloc_eprofile::id, and NULL.
| struct ast_datastore * ast_geoloc_datastore_create_from_profile_name | ( | const char * | profile_name | ) | 
Geolocation datastore Functions.
Create a geoloc datastore from a profile name
| profile_name | The name of the profile to use. | 
Definition at line 266 of file geoloc_datastore.c.
References ao2_ref, ast_datastore_free(), ast_geoloc_datastore_add_eprofile(), ast_geoloc_datastore_create(), ast_geoloc_eprofile_create_from_profile(), ast_log, ast_sorcery_retrieve_by_id(), ast_strlen_zero(), geoloc_sorcery, LOG_ERROR, and NULL.
| int ast_geoloc_datastore_delete_eprofile | ( | struct ast_datastore * | ds, | 
| int | ix | ||
| ) | 
Delete a specific eprofile from a datastore by index.
| ds | The datastore | 
| ix | The index | 
Definition at line 224 of file geoloc_datastore.c.
References ao2_ref, AST_VECTOR_REMOVE, AST_VECTOR_SIZE, ast_datastore::data, eprofiles_datastore::eprofiles, IS_GEOLOC_DS, and NULL.
| struct ast_datastore * ast_geoloc_datastore_find | ( | struct ast_channel * | chan | ) | 
Retrieves the geoloc datastore from a channel, if any.
| chan | Channel | 
Definition at line 219 of file geoloc_datastore.c.
References ast_channel_datastore_find(), geoloc_datastore_info, and NULL.
Referenced by geoloc_profile_read(), geoloc_profile_write(), and handle_outgoing_request().
| struct ast_geoloc_eprofile * ast_geoloc_datastore_get_eprofile | ( | struct ast_datastore * | ds, | 
| int | ix | ||
| ) | 
Retrieve a specific eprofile from a datastore by index.
| ds | The datastore | 
| ix | The index | 
Definition at line 200 of file geoloc_datastore.c.
References ao2_bump, AST_VECTOR_GET, AST_VECTOR_SIZE, ast_datastore::data, eprofiles_datastore::eprofiles, IS_GEOLOC_DS, and NULL.
Referenced by ast_geoloc_eprofiles_to_pidf(), geoloc_profile_read(), geoloc_profile_write(), and handle_outgoing_request().
| const char * ast_geoloc_datastore_get_id | ( | struct ast_datastore * | ds | ) | 
Retrieve a geoloc datastore's id.
| ds | The datastore | 
Definition at line 86 of file geoloc_datastore.c.
References ast_datastore::data, eprofiles_datastore::id, IS_GEOLOC_DS, and NULL.
| int ast_geoloc_datastore_insert_eprofile | ( | struct ast_datastore * | ds, | 
| struct ast_geoloc_eprofile * | eprofile, | ||
| int | index | ||
| ) | 
Insert an eprofile to a datastore at the specified position.
| ds | The datastore | 
| eprofile | The eprofile to add. | 
| index | The position to insert at. Existing eprofiles will be moved up to make room. | 
Definition at line 156 of file geoloc_datastore.c.
References ao2_bump, ao2_ref, ast_log, AST_VECTOR_INSERT_AT, AST_VECTOR_SIZE, ast_datastore::data, eprofiles_datastore::eprofiles, ast_geoloc_eprofile::id, eprofiles_datastore::id, IS_GEOLOC_DS, LOG_ERROR, and NULL.
| int ast_geoloc_datastore_set_inheritance | ( | struct ast_datastore * | ds, | 
| int | inherit | ||
| ) | 
Sets the inheritance flag on the datastore.
| ds | The datastore | 
| inherit | 1 to allow the datastore to be inherited by other channels 0 to prevent the datastore to be inherited by other channels | 
Definition at line 191 of file geoloc_datastore.c.
References DATASTORE_INHERIT_FOREVER, ast_datastore::inheritance, and IS_GEOLOC_DS.
Referenced by add_eprofile_to_channel(), and geoloc_profile_write().
| int ast_geoloc_datastore_size | ( | struct ast_datastore * | ds | ) | 
Retrieves the number of eprofiles in the datastore.
| ds | The datastore | 
Definition at line 178 of file geoloc_datastore.c.
References AST_VECTOR_SIZE, ast_datastore::data, eprofiles_datastore::eprofiles, IS_GEOLOC_DS, and NULL.
Referenced by ast_geoloc_eprofiles_to_pidf(), and handle_outgoing_request().
| int geoloc_channel_load | ( | void | ) | 
Definition at line 316 of file geoloc_datastore.c.
References AST_MODULE_LOAD_SUCCESS, geoloc_get_sorcery(), and geoloc_sorcery.
Referenced by load_module().
| int geoloc_channel_reload | ( | void | ) | 
Definition at line 322 of file geoloc_datastore.c.
References AST_MODULE_LOAD_SUCCESS.
Referenced by reload_module().
| int geoloc_channel_unload | ( | void | ) | 
Definition at line 308 of file geoloc_datastore.c.
References AST_MODULE_LOAD_SUCCESS, ast_sorcery_unref, and geoloc_sorcery.
Referenced by unload_module().
| 
 | static | 
Definition at line 45 of file geoloc_datastore.c.
References ao2_bump, ast_calloc, ast_free, AST_VECTOR_APPEND, AST_VECTOR_GET, AST_VECTOR_INIT, AST_VECTOR_SIZE, eprofiles_datastore::eprofiles, geoloc_datastore_free(), and NULL.
| 
 | static | 
Definition at line 36 of file geoloc_datastore.c.
References ao2_cleanup, ast_free, AST_VECTOR_FREE, AST_VECTOR_RESET, and eprofiles_datastore::eprofiles.
Referenced by geoloc_datastore_duplicate().
| 
 | static | 
Definition at line 78 of file geoloc_datastore.c.
Referenced by ast_geoloc_datastore_create(), and ast_geoloc_datastore_find().
| struct ast_sorcery* geoloc_sorcery | 
Definition at line 29 of file geoloc_datastore.c.
Referenced by ast_geoloc_datastore_create_from_profile_name(), geoloc_channel_load(), and geoloc_channel_unload().