Asterisk - The Open Source Telephony Project  GIT-master-932eae6
Functions | Variables
func_realtime.c File Reference

REALTIME dialplan function. More...

#include "asterisk.h"
#include "asterisk/file.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/config.h"
#include "asterisk/module.h"
#include "asterisk/lock.h"
#include "asterisk/utils.h"
#include "asterisk/app.h"

Go to the source code of this file.

Functions

static void __init_buf1 (void)
 
static void __init_buf2 (void)
 
static void __init_buf3 (void)
 
static void __reg_module (void)
 
static void __unreg_module (void)
 
struct ast_moduleAST_MODULE_SELF_SYM (void)
 
static int function_realtime_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
 
static int function_realtime_readdestroy (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
 
static int function_realtime_store (struct ast_channel *chan, const char *cmd, char *data, const char *value)
 
static int function_realtime_write (struct ast_channel *chan, const char *cmd, char *data, const char *value)
 
static int function_realtime_writedestroy (struct ast_channel *chan, const char *cmd, char *data, const char *value)
 Wrapper to execute REALTIME_DESTROY from a write operation. Allows execution even if live_dangerously is disabled. More...
 
static int load_module (void)
 
static int realtimefield_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
 
static int unload_module (void)
 

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Read/Write/Store/Destroy values from a RealTime repository" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, }
 
static const struct ast_module_infoast_module_info = &__mod_info
 
static struct ast_threadstorage buf1 = { .once = PTHREAD_ONCE_INIT , .key_init = __init_buf1 , .custom_init = NULL , }
 
static struct ast_threadstorage buf2 = { .once = PTHREAD_ONCE_INIT , .key_init = __init_buf2 , .custom_init = NULL , }
 
static struct ast_threadstorage buf3 = { .once = PTHREAD_ONCE_INIT , .key_init = __init_buf3 , .custom_init = NULL , }
 
static struct ast_custom_function realtime_destroy_function
 
static struct ast_custom_function realtime_function
 
static struct ast_custom_function realtime_store_function
 
static struct ast_custom_function realtimefield_function
 
static struct ast_custom_function realtimehash_function
 

Detailed Description

REALTIME dialplan function.

Author
BJ Weschke bwesc.nosp@m.hke@.nosp@m.btwte.nosp@m.ch.c.nosp@m.om

Definition in file func_realtime.c.

Function Documentation

◆ __init_buf1()

static void __init_buf1 ( void  )
static

Definition at line 178 of file func_realtime.c.

183 {

◆ __init_buf2()

static void __init_buf2 ( void  )
static

Definition at line 179 of file func_realtime.c.

183 {

◆ __init_buf3()

static void __init_buf3 ( void  )
static

Definition at line 180 of file func_realtime.c.

183 {

◆ __reg_module()

static void __reg_module ( void  )
static

Definition at line 547 of file func_realtime.c.

◆ __unreg_module()

static void __unreg_module ( void  )
static

Definition at line 547 of file func_realtime.c.

◆ AST_MODULE_SELF_SYM()

struct ast_module* AST_MODULE_SELF_SYM ( void  )

Definition at line 547 of file func_realtime.c.

◆ function_realtime_read()

static int function_realtime_read ( struct ast_channel chan,
const char *  cmd,
char *  data,
char *  buf,
size_t  len 
)
static

Definition at line 182 of file func_realtime.c.

References args, AST_APP_ARG, ast_autoservice_start(), ast_autoservice_stop(), ast_copy_string(), AST_DECLARE_APP_ARGS, ast_load_realtime_all(), ast_log, AST_STANDARD_APP_ARGS, ast_str_alloca, ast_str_append(), ast_str_buffer(), ast_strlen_zero, ast_variables_destroy(), LOG_WARNING, ast_variable::next, out, SENTINEL, value, and var.

183 {
184  struct ast_variable *var, *head;
185  struct ast_str *out;
186  size_t resultslen;
187  int n;
189  AST_APP_ARG(family);
190  AST_APP_ARG(fieldmatch);
192  AST_APP_ARG(delim1);
193  AST_APP_ARG(delim2);
194  );
195 
196  if (ast_strlen_zero(data)) {
197  ast_log(LOG_WARNING, "Syntax: REALTIME(family,fieldmatch[,matchvalue[,delim1[,delim2]]]) - missing argument!\n");
198  return -1;
199  }
200 
202 
203  if (!args.delim1)
204  args.delim1 = ",";
205  if (!args.delim2)
206  args.delim2 = "=";
207 
208  if (chan)
209  ast_autoservice_start(chan);
210 
211  head = ast_load_realtime_all(args.family, args.fieldmatch, args.value, SENTINEL);
212 
213  if (!head) {
214  if (chan)
215  ast_autoservice_stop(chan);
216  return -1;
217  }
218 
219  resultslen = 0;
220  n = 0;
221  for (var = head; var; n++, var = var->next)
222  resultslen += strlen(var->name) + strlen(var->value);
223  /* add space for delimiters and final '\0' */
224  resultslen += n * (strlen(args.delim1) + strlen(args.delim2)) + 1;
225 
226  if (resultslen > len) {
227  ast_log(LOG_WARNING, "Failed to fetch. Realtime data is too large: need %zu, have %zu.\n", resultslen, len);
228  if (chan) {
229  ast_autoservice_stop(chan);
230  }
231  return -1;
232  }
233 
234  /* len is going to be sensible, so we don't need to check for stack
235  * overflows here. */
236  out = ast_str_alloca(resultslen);
237  for (var = head; var; var = var->next)
238  ast_str_append(&out, 0, "%s%s%s%s", var->name, args.delim2, var->value, args.delim1);
240 
241  ast_variables_destroy(head);
242 
243  if (chan)
244  ast_autoservice_stop(chan);
245 
246  return 0;
247 }
struct ast_variable * next
int ast_autoservice_start(struct ast_channel *chan)
Automatically service a channel for us...
Definition: autoservice.c:200
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
Definition: extconf.c:1263
char buf[BUFSIZE]
Definition: eagi_proxy.c:66
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define LOG_WARNING
Definition: logger.h:274
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
Definition: strings.h:714
Structure for variables, used for configurations and for channel variables.
#define var
Definition: ast_expr2f.c:614
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
Definition: strings.h:1091
#define ast_str_alloca(init_len)
Definition: strings.h:800
const char * args
int value
Definition: syslog.c:37
#define ast_log
Definition: astobj2.c:42
#define SENTINEL
Definition: compiler.h:87
int ast_autoservice_stop(struct ast_channel *chan)
Stop servicing a channel for us...
Definition: autoservice.c:266
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
Definition: strings.h:584
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
#define ast_strlen_zero(a)
Definition: muted.c:73
FILE * out
Definition: utils/frame.c:33
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:401
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
struct ast_variable * ast_load_realtime_all(const char *family,...) attribute_sentinel
Definition: main/config.c:3287
#define AST_APP_ARG(name)
Define an application argument.

◆ function_realtime_readdestroy()

static int function_realtime_readdestroy ( struct ast_channel chan,
const char *  cmd,
char *  data,
char *  buf,
size_t  len 
)
static

Definition at line 412 of file func_realtime.c.

References args, AST_APP_ARG, ast_autoservice_start(), ast_autoservice_stop(), ast_copy_string(), AST_DECLARE_APP_ARGS, ast_destroy_realtime(), ast_load_realtime_all(), ast_log, AST_STANDARD_APP_ARGS, ast_str_alloca, ast_str_append(), ast_str_buffer(), ast_strlen_zero, ast_variables_destroy(), LOG_WARNING, ast_variable::next, out, SENTINEL, value, and var.

Referenced by function_realtime_writedestroy().

413 {
414  struct ast_variable *var, *head;
415  struct ast_str *out;
416  size_t resultslen;
417  int n;
419  AST_APP_ARG(family);
420  AST_APP_ARG(fieldmatch);
422  AST_APP_ARG(delim1);
423  AST_APP_ARG(delim2);
424  );
425 
426  if (ast_strlen_zero(data)) {
427  ast_log(LOG_WARNING, "Syntax: REALTIME_DESTROY(family,fieldmatch[,matchvalue[,delim1[,delim2]]]) - missing argument!\n");
428  return -1;
429  }
430 
432 
433  if (!args.delim1)
434  args.delim1 = ",";
435  if (!args.delim2)
436  args.delim2 = "=";
437 
438  if (chan)
439  ast_autoservice_start(chan);
440 
441  head = ast_load_realtime_all(args.family, args.fieldmatch, args.value, SENTINEL);
442 
443  if (!head) {
444  if (chan)
445  ast_autoservice_stop(chan);
446  return -1;
447  }
448 
449  if (len > 0) {
450  resultslen = 0;
451  n = 0;
452  for (var = head; var; n++, var = var->next) {
453  resultslen += strlen(var->name) + strlen(var->value);
454  }
455  /* add space for delimiters and final '\0' */
456  resultslen += n * (strlen(args.delim1) + strlen(args.delim2)) + 1;
457 
458  if (resultslen > len) {
459  /* Unfortunately this does mean that we cannot destroy
460  * the row anymore. But OTOH, we're not destroying
461  * someones data without giving him the chance to look
462  * at it. */
463  ast_log(LOG_WARNING, "Failed to fetch/destroy. Realtime data is too large: need %zu, have %zu.\n", resultslen, len);
464  if (chan) {
465  ast_autoservice_stop(chan);
466  }
467  return -1;
468  }
469 
470  /* len is going to be sensible, so we don't need to check for
471  * stack overflows here. */
472  out = ast_str_alloca(resultslen);
473  for (var = head; var; var = var->next) {
474  ast_str_append(&out, 0, "%s%s%s%s", var->name, args.delim2, var->value, args.delim1);
475  }
477  }
478 
479  ast_destroy_realtime(args.family, args.fieldmatch, args.value, SENTINEL);
480  ast_variables_destroy(head);
481 
482  if (chan)
483  ast_autoservice_stop(chan);
484 
485  return 0;
486 }
struct ast_variable * next
int ast_autoservice_start(struct ast_channel *chan)
Automatically service a channel for us...
Definition: autoservice.c:200
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
Definition: extconf.c:1263
char buf[BUFSIZE]
Definition: eagi_proxy.c:66
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define LOG_WARNING
Definition: logger.h:274
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
Definition: strings.h:714
Structure for variables, used for configurations and for channel variables.
#define var
Definition: ast_expr2f.c:614
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
Definition: strings.h:1091
#define ast_str_alloca(init_len)
Definition: strings.h:800
const char * args
int value
Definition: syslog.c:37
#define ast_log
Definition: astobj2.c:42
#define SENTINEL
Definition: compiler.h:87
int ast_autoservice_stop(struct ast_channel *chan)
Stop servicing a channel for us...
Definition: autoservice.c:266
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
Definition: strings.h:584
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
#define ast_strlen_zero(a)
Definition: muted.c:73
FILE * out
Definition: utils/frame.c:33
int ast_destroy_realtime(const char *family, const char *keyfield, const char *lookup,...) attribute_sentinel
Destroy realtime configuration.
Definition: main/config.c:3606
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:401
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
struct ast_variable * ast_load_realtime_all(const char *family,...) attribute_sentinel
Definition: main/config.c:3287
#define AST_APP_ARG(name)
Define an application argument.

◆ function_realtime_store()

static int function_realtime_store ( struct ast_channel chan,
const char *  cmd,
char *  data,
const char *  value 
)
static

Definition at line 364 of file func_realtime.c.

References a, AST_APP_ARG, ast_autoservice_start(), ast_autoservice_stop(), AST_DECLARE_APP_ARGS, ast_log, AST_STANDARD_APP_ARGS, ast_store_realtime(), ast_strdupa, ast_strlen_zero, LOG_WARNING, pbx_builtin_setvar_helper(), and SENTINEL.

365 {
366  int res = 0;
367  char storeid[32];
368  char *valcopy;
370  AST_APP_ARG(family);
371  AST_APP_ARG(f)[30]; /* fields */
372  );
373 
375  AST_APP_ARG(v)[30]; /* values */
376  );
377 
378  if (ast_strlen_zero(data)) {
379  ast_log(LOG_WARNING, "Syntax: REALTIME_STORE(family,field1,field2,...,field30) - missing argument!\n");
380  return -1;
381  }
382 
383  if (chan)
384  ast_autoservice_start(chan);
385 
386  valcopy = ast_strdupa(value);
387  AST_STANDARD_APP_ARGS(a, data);
388  AST_STANDARD_APP_ARGS(v, valcopy);
389 
390  res = ast_store_realtime(a.family,
391  a.f[0], v.v[0], a.f[1], v.v[1], a.f[2], v.v[2], a.f[3], v.v[3], a.f[4], v.v[4],
392  a.f[5], v.v[5], a.f[6], v.v[6], a.f[7], v.v[7], a.f[8], v.v[8], a.f[9], v.v[9],
393  a.f[10], v.v[10], a.f[11], v.v[11], a.f[12], v.v[12], a.f[13], v.v[13], a.f[14], v.v[14],
394  a.f[15], v.v[15], a.f[16], v.v[16], a.f[17], v.v[17], a.f[18], v.v[18], a.f[19], v.v[19],
395  a.f[20], v.v[20], a.f[21], v.v[21], a.f[22], v.v[22], a.f[23], v.v[23], a.f[24], v.v[24],
396  a.f[25], v.v[25], a.f[26], v.v[26], a.f[27], v.v[27], a.f[28], v.v[28], a.f[29], v.v[29], SENTINEL
397  );
398 
399  if (res < 0) {
400  ast_log(LOG_WARNING, "Failed to store. Check the debug log for possible data repository related entries.\n");
401  } else {
402  snprintf(storeid, sizeof(storeid), "%d", res);
403  pbx_builtin_setvar_helper(chan, "RTSTOREID", storeid);
404  }
405 
406  if (chan)
407  ast_autoservice_stop(chan);
408 
409  return 0;
410 }
int ast_autoservice_start(struct ast_channel *chan)
Automatically service a channel for us...
Definition: autoservice.c:200
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the &#39;standard&#39; argument separation process for an application.
#define LOG_WARNING
Definition: logger.h:274
int value
Definition: syslog.c:37
#define ast_log
Definition: astobj2.c:42
#define SENTINEL
Definition: compiler.h:87
int ast_store_realtime(const char *family,...) attribute_sentinel
Create realtime configuration.
Definition: main/config.c:3570
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:300
int ast_autoservice_stop(struct ast_channel *chan)
Stop servicing a channel for us...
Definition: autoservice.c:266
#define ast_strlen_zero(a)
Definition: muted.c:73
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name...
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application&#39;s arguments.
#define AST_APP_ARG(name)
Define an application argument.
static struct test_val a

◆ function_realtime_write()

static int function_realtime_write ( struct ast_channel chan,
const char *  cmd,
char *  data,
const char *  value 
)
static

Definition at line 249 of file func_realtime.c.

References args, AST_APP_ARG, ast_autoservice_start(), ast_autoservice_stop(), AST_DECLARE_APP_ARGS, ast_log, AST_STANDARD_APP_ARGS, ast_strlen_zero, ast_update_realtime(), LOG_WARNING, and SENTINEL.

250 {
251  int res = 0;
253  AST_APP_ARG(family);
254  AST_APP_ARG(fieldmatch);
256  AST_APP_ARG(field);
257  );
258 
259  if (ast_strlen_zero(data)) {
260  ast_log(LOG_WARNING, "Syntax: %s(family,fieldmatch,matchvalue,updatecol) - missing argument!\n", cmd);
261  return -1;
262  }
263 
265 
266  if (ast_strlen_zero(args.fieldmatch) || ast_strlen_zero(args.field)) {
267  ast_log(LOG_WARNING, "Syntax: %s(family,fieldmatch,matchvalue,updatecol) - missing argument!\n", cmd);
268  return -1;
269  }
270 
271  if (chan) {
272  ast_autoservice_start(chan);
273  }
274 
275  res = ast_update_realtime(args.family, args.fieldmatch, args.value, args.field, (char *)value, SENTINEL);
276 
277  if (res < 0) {
278  ast_log(LOG_WARNING, "Failed to update. Check the debug log for possible data repository related entries.\n");
279  }
280 
281  if (chan) {
282  ast_autoservice_stop(chan);
283  }
284 
285  return res;
286 }
int ast_autoservice_start(struct ast_channel *chan)
Automatically service a channel for us...
Definition: autoservice.c:200
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the &#39;standard&#39; argument separation process for an application.
#define LOG_WARNING
Definition: logger.h:274
const char * args
int value
Definition: syslog.c:37
int ast_update_realtime(const char *family, const char *keyfield, const char *lookup,...) attribute_sentinel
Update realtime configuration.
Definition: main/config.c:3489
#define ast_log
Definition: astobj2.c:42
#define SENTINEL
Definition: compiler.h:87
int ast_autoservice_stop(struct ast_channel *chan)
Stop servicing a channel for us...
Definition: autoservice.c:266
#define ast_strlen_zero(a)
Definition: muted.c:73
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application&#39;s arguments.
#define AST_APP_ARG(name)
Define an application argument.

◆ function_realtime_writedestroy()

static int function_realtime_writedestroy ( struct ast_channel chan,
const char *  cmd,
char *  data,
const char *  value 
)
static

Wrapper to execute REALTIME_DESTROY from a write operation. Allows execution even if live_dangerously is disabled.

Definition at line 492 of file func_realtime.c.

References function_realtime_readdestroy(), and NULL.

493 {
494  return function_realtime_readdestroy(chan, cmd, data, NULL, 0);
495 }
#define NULL
Definition: resample.c:96
static int function_realtime_readdestroy(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)

◆ load_module()

static int load_module ( void  )
static

Definition at line 536 of file func_realtime.c.

References AST_CFE_READ, ast_custom_function_register, and ast_custom_function_register_escalating.

537 {
538  int res = 0;
544  return res;
545 }
static struct ast_custom_function realtime_store_function
static struct ast_custom_function realtimehash_function
static struct ast_custom_function realtime_function
static struct ast_custom_function realtime_destroy_function
#define ast_custom_function_register_escalating(acf, escalation)
Register a custom function which requires escalated privileges.
Definition: pbx.h:1517
static struct ast_custom_function realtimefield_function
#define ast_custom_function_register(acf)
Register a custom function.
Definition: pbx.h:1508

◆ realtimefield_read()

static int realtimefield_read ( struct ast_channel chan,
const char *  cmd,
char *  data,
char *  buf,
size_t  len 
)
static

Definition at line 288 of file func_realtime.c.

References args, AST_APP_ARG, ast_autoservice_start(), ast_autoservice_stop(), ast_copy_string(), ast_debug, AST_DECLARE_APP_ARGS, ast_load_realtime_all(), ast_log, AST_STANDARD_APP_ARGS, ast_str_append(), ast_str_buffer(), ast_str_reset(), ast_str_set_escapecommas(), ast_str_thread_get(), ast_strlen_zero, ast_variables_destroy(), buf1, buf2, buf3, first, LOG_WARNING, ast_variable::name, ast_variable::next, pbx_builtin_setvar_helper(), SENTINEL, value, ast_variable::value, and var.

289 {
290  struct ast_variable *var, *head;
291  struct ast_str *escapebuf = ast_str_thread_get(&buf1, 16);
292  struct ast_str *fields = ast_str_thread_get(&buf2, 16);
293  struct ast_str *values = ast_str_thread_get(&buf3, 16);
294  int first = 0;
295  enum { rtfield, rthash } which;
297  AST_APP_ARG(family);
298  AST_APP_ARG(fieldmatch);
300  AST_APP_ARG(fieldname);
301  );
302 
303  if (!strcmp(cmd, "REALTIME_FIELD")) {
304  which = rtfield;
305  } else {
306  which = rthash;
307  }
308 
309  if (ast_strlen_zero(data)) {
310  ast_log(LOG_WARNING, "Syntax: %s(family,fieldmatch,matchvalue%s) - missing argument!\n", cmd, which == rtfield ? ",fieldname" : "");
311  return -1;
312  }
313 
315 
316  if ((which == rtfield && args.argc != 4) || (which == rthash && args.argc != 3)) {
317  ast_log(LOG_WARNING, "Syntax: %s(family,fieldmatch,matchvalue%s) - missing argument!\n", cmd, which == rtfield ? ",fieldname" : "");
318  return -1;
319  }
320 
321  if (chan) {
322  ast_autoservice_start(chan);
323  }
324 
325  if (!(head = ast_load_realtime_all(args.family, args.fieldmatch, args.value, SENTINEL))) {
326  if (chan) {
327  ast_autoservice_stop(chan);
328  }
329  return -1;
330  }
331 
332  ast_str_reset(fields);
333  ast_str_reset(values);
334 
335  for (var = head; var; var = var->next) {
336  if (which == rtfield) {
337  ast_debug(1, "Comparing %s to %s\n", var->name, args.fieldname);
338  if (!strcasecmp(var->name, args.fieldname)) {
339  ast_debug(1, "Match! Value is %s\n", var->value);
340  ast_copy_string(buf, var->value, len);
341  break;
342  }
343  } else if (which == rthash) {
344  ast_debug(1, "Setting hash key %s to value %s\n", var->name, var->value);
345  ast_str_append(&fields, 0, "%s%s", first ? "" : ",", ast_str_set_escapecommas(&escapebuf, 0, var->name, INT_MAX));
346  ast_str_append(&values, 0, "%s%s", first ? "" : ",", ast_str_set_escapecommas(&escapebuf, 0, var->value, INT_MAX));
347  first = 0;
348  }
349  }
350  ast_variables_destroy(head);
351 
352  if (which == rthash) {
353  pbx_builtin_setvar_helper(chan, "~ODBCFIELDS~", ast_str_buffer(fields));
355  }
356 
357  if (chan) {
358  ast_autoservice_stop(chan);
359  }
360 
361  return 0;
362 }
struct ast_variable * next
int ast_autoservice_start(struct ast_channel *chan)
Automatically service a channel for us...
Definition: autoservice.c:200
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
Definition: extconf.c:1263
char buf[BUFSIZE]
Definition: eagi_proxy.c:66
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the &#39;standard&#39; argument separation process for an application.
#define LOG_WARNING
Definition: logger.h:274
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
Definition: strings.h:714
Structure for variables, used for configurations and for channel variables.
#define var
Definition: ast_expr2f.c:614
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
Definition: strings.h:1091
static struct ast_threadstorage buf2
const char * args
int value
Definition: syslog.c:37
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:444
#define ast_log
Definition: astobj2.c:42
#define SENTINEL
Definition: compiler.h:87
static struct ast_threadstorage buf3
int ast_autoservice_stop(struct ast_channel *chan)
Stop servicing a channel for us...
Definition: autoservice.c:266
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
Definition: strings.h:584
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
struct sla_ringing_trunk * first
Definition: app_meetme.c:1092
static struct ast_threadstorage buf1
#define ast_strlen_zero(a)
Definition: muted.c:73
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name...
char * ast_str_set_escapecommas(struct ast_str **buf, ssize_t maxlen, const char *src, size_t maxsrc)
Set a dynamic string to a non-NULL terminated substring, with escaping of commas. ...
Definition: strings.h:1021
void ast_str_reset(struct ast_str *buf)
Reset the content of a dynamic string. Useful before a series of ast_str_append.
Definition: strings.h:653
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:401
struct ast_str * ast_str_thread_get(struct ast_threadstorage *ts, size_t init_len)
Retrieve a thread locally stored dynamic string.
Definition: strings.h:861
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application&#39;s arguments.
struct ast_variable * ast_load_realtime_all(const char *family,...) attribute_sentinel
Definition: main/config.c:3287
#define AST_APP_ARG(name)
Define an application argument.

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 525 of file func_realtime.c.

References ast_custom_function_unregister().

526 {
527  int res = 0;
533  return res;
534 }
static struct ast_custom_function realtime_store_function
static struct ast_custom_function realtimehash_function
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
static struct ast_custom_function realtime_function
static struct ast_custom_function realtime_destroy_function
static struct ast_custom_function realtimefield_function

Variable Documentation

◆ __mod_info

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Read/Write/Store/Destroy values from a RealTime repository" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, }
static

Definition at line 547 of file func_realtime.c.

◆ ast_module_info

const struct ast_module_info* ast_module_info = &__mod_info
static

Definition at line 547 of file func_realtime.c.

◆ buf1

struct ast_threadstorage buf1 = { .once = PTHREAD_ONCE_INIT , .key_init = __init_buf1 , .custom_init = NULL , }
static

◆ buf2

struct ast_threadstorage buf2 = { .once = PTHREAD_ONCE_INIT , .key_init = __init_buf2 , .custom_init = NULL , }
static

◆ buf3

struct ast_threadstorage buf3 = { .once = PTHREAD_ONCE_INIT , .key_init = __init_buf3 , .custom_init = NULL , }
static

Definition at line 180 of file func_realtime.c.

Referenced by realtimefield_read().

◆ realtime_destroy_function

struct ast_custom_function realtime_destroy_function
static
Initial value:
= {
.name = "REALTIME_DESTROY",
}
static int function_realtime_writedestroy(struct ast_channel *chan, const char *cmd, char *data, const char *value)
Wrapper to execute REALTIME_DESTROY from a write operation. Allows execution even if live_dangerously...
static int function_realtime_readdestroy(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)

Definition at line 519 of file func_realtime.c.

◆ realtime_function

struct ast_custom_function realtime_function
static
Initial value:
= {
.name = "REALTIME",
}
static int function_realtime_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
static int function_realtime_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)

Definition at line 497 of file func_realtime.c.

◆ realtime_store_function

struct ast_custom_function realtime_store_function
static
Initial value:
= {
.name = "REALTIME_STORE",
}
static int function_realtime_store(struct ast_channel *chan, const char *cmd, char *data, const char *value)

Definition at line 514 of file func_realtime.c.

◆ realtimefield_function

struct ast_custom_function realtimefield_function
static
Initial value:
= {
.name = "REALTIME_FIELD",
}
static int function_realtime_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
static int realtimefield_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)

Definition at line 503 of file func_realtime.c.

◆ realtimehash_function

struct ast_custom_function realtimehash_function
static
Initial value:
= {
.name = "REALTIME_HASH",
}
static int realtimefield_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)

Definition at line 509 of file func_realtime.c.