Asterisk - The Open Source Telephony Project  18.5.0
phoneprov.h
Go to the documentation of this file.
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 2014 - Fairview 5 Engineering, LLC
5  *
6  * George Joseph <[email protected]>
7  *
8  * See http://www.asterisk.org for more information about
9  * the Asterisk project. Please do not directly contact
10  * any of the maintainers of this project for assistance;
11  * the project provides a web site, mailing lists and IRC
12  * channels for your use.
13  *
14  * This program is free software, distributed under the terms of
15  * the GNU General Public License Version 2. See the LICENSE file
16  * at the top of the source tree.
17  */
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #ifndef _ASTERISK_PHONEPROV_H
24 #define _ASTERISK_PHONEPROV_H
25 
26 #include "asterisk.h"
27 #include "asterisk/inline_api.h"
28 
53  AST_PHONEPROV_STD_VAR_LIST_LENGTH, /* This entry must always be the last in the list */
54 };
55 
56 /*!
57  * \brief Returns the string respresentation of a phoneprov standard variable.
58  * \param var One of enum ast_phoneprov_std_variables
59  *
60  * \return The string representation or NULL if not found.
61  */
63 
64 /*!
65  * \brief Causes the provider to load its users.
66  *
67  * This function is called by phoneprov in response to a
68  * ast_phoneprov_provider_register call by the provider.
69  * It may also be called by phoneprov to request a reload in
70  * response to the res_phoneprov module being reloaded.
71  *
72  * \retval 0 if successful
73  * \retval non-zero if failure
74  */
75 typedef int(*ast_phoneprov_load_users_cb)(void);
76 
77 /*!
78  * \brief Registers a config provider to phoneprov.
79  * \param provider_name The name of the provider
80  * \param load_users Callback that gathers user variables then loads them by
81  * calling ast_phoneprov_add_extension once for each extension.
82  *
83  * \retval 0 if successful
84  * \retval non-zero if failure
85  */
86 int ast_phoneprov_provider_register(char *provider_name,
88 
89 /*!
90  * \brief Unegisters a config provider from phoneprov and frees its resources.
91  * \param provider_name The name of the provider
92  */
93 void ast_phoneprov_provider_unregister(char *provider_name);
94 
95 /*!
96  * \brief Adds an extension
97  * \param provider_name The name of the provider
98  * \param defaults An ast_vat_t linked list of the extension's variables.
99  * The list is automatically cloned and it must contain at least MACADDRESS
100  * and USERNAME entries.
101  *
102  * \retval 0 if successful
103  * \retval non-zero if failure
104  */
105 int ast_phoneprov_add_extension(char *provider_name, struct varshead *vars);
106 
107 /*!
108  * \brief Deletes an extension
109  * \param provider_name The name of the provider
110  * \param macaddress The mac address of the extension
111  */
112 void ast_phoneprov_delete_extension(char *provider_name, char *macaddress);
113 
114 /*!
115  * \brief Deletes all extensions for this provider
116  * \param provider_name The name of the provider
117  */
118 void ast_phoneprov_delete_extensions(char *provider_name);
119 
120 #endif /* _ASTERISK_PHONEPROV_H */
121 
122 #ifdef __cplusplus
123 }
124 #endif
Asterisk main include file. File version handling, generic pbx functions.
ast_phoneprov_std_variables
Definition: phoneprov.h:29
#define var
Definition: ast_expr2f.c:614
int(* ast_phoneprov_load_users_cb)(void)
Causes the provider to load its users.
Definition: phoneprov.h:75
static void load_users(struct ast_config *cfg)
int ast_phoneprov_provider_register(char *provider_name, ast_phoneprov_load_users_cb load_users)
Registers a config provider to phoneprov.
void ast_phoneprov_delete_extensions(char *provider_name)
Deletes all extensions for this provider.
Inlinable API function macro.
void ast_phoneprov_provider_unregister(char *provider_name)
Unegisters a config provider from phoneprov and frees its resources.
int ast_phoneprov_add_extension(char *provider_name, struct varshead *vars)
Adds an extension.
const char * ast_phoneprov_std_variable_lookup(enum ast_phoneprov_std_variables var)
Returns the string respresentation of a phoneprov standard variable.
void ast_phoneprov_delete_extension(char *provider_name, char *macaddress)
Deletes an extension.