Sat Apr 26 2014 22:02:52

Asterisk developer's documentation


global_datastores.c File Reference

globally-accessible datastore information and callbacks More...

Include dependency graph for global_datastores.c:

Go to the source code of this file.

Functions

static void dialed_interface_destroy (void *data)
static void * dialed_interface_duplicate (void *data)
static void secure_call_store_destroy (void *data)
static void * secure_call_store_duplicate (void *data)

Variables

struct ast_datastore_info dialed_interface_info
struct ast_datastore_info secure_call_info

Detailed Description

globally-accessible datastore information and callbacks

Author:
Mark Michelson <mmichelson@digium.com>

Definition in file global_datastores.c.


Function Documentation

static void dialed_interface_destroy ( void *  data) [static]

Definition at line 37 of file global_datastores.c.

References ast_free, AST_LIST_HEAD, AST_LIST_HEAD_DESTROY, AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, di, and ast_dialed_interface::list.

Referenced by dialed_interface_duplicate().

{
   struct ast_dialed_interface *di = NULL;
   AST_LIST_HEAD(, ast_dialed_interface) *dialed_interface_list = data;
   
   if (!dialed_interface_list) {
      return;
   }

   AST_LIST_LOCK(dialed_interface_list);
   while ((di = AST_LIST_REMOVE_HEAD(dialed_interface_list, list)))
      ast_free(di);
   AST_LIST_UNLOCK(dialed_interface_list);

   AST_LIST_HEAD_DESTROY(dialed_interface_list);
   ast_free(dialed_interface_list);
}
static void* dialed_interface_duplicate ( void *  data) [static]

Definition at line 55 of file global_datastores.c.

References ast_calloc, AST_LIST_HEAD, AST_LIST_HEAD_INIT, AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, di, dialed_interface_destroy(), ast_dialed_interface::interface, and ast_dialed_interface::list.

{
   struct ast_dialed_interface *di = NULL;
   AST_LIST_HEAD(, ast_dialed_interface) *old_list;
   AST_LIST_HEAD(, ast_dialed_interface) *new_list = NULL;

   if(!(old_list = data)) {
      return NULL;
   }

   if(!(new_list = ast_calloc(1, sizeof(*new_list)))) {
      return NULL;
   }

   AST_LIST_HEAD_INIT(new_list);
   AST_LIST_LOCK(old_list);
   AST_LIST_TRAVERSE(old_list, di, list) {
      struct ast_dialed_interface *di2 = ast_calloc(1, sizeof(*di2) + strlen(di->interface));
      if(!di2) {
         AST_LIST_UNLOCK(old_list);
         dialed_interface_destroy(new_list);
         return NULL;
      }
      strcpy(di2->interface, di->interface);
      AST_LIST_INSERT_TAIL(new_list, di2, list);
   }
   AST_LIST_UNLOCK(old_list);

   return new_list;
}
static void secure_call_store_destroy ( void *  data) [static]

Definition at line 92 of file global_datastores.c.

References ast_free.

{
   struct ast_secure_call_store *store = data;

   ast_free(store);
}
static void* secure_call_store_duplicate ( void *  data) [static]

Definition at line 99 of file global_datastores.c.

References ast_calloc, ast_secure_call_store::media, and ast_secure_call_store::signaling.

{
   struct ast_secure_call_store *old = data;
   struct ast_secure_call_store *new;

   if (!(new = ast_calloc(1, sizeof(*new)))) {
      return NULL;
   }
   new->signaling = old->signaling;
   new->media = old->media;

   return new;
}

Variable Documentation

Initial value:
 {
   .type = "dialed-interface",
   .destroy = dialed_interface_destroy,
   .duplicate = dialed_interface_duplicate,
}

Definition at line 86 of file global_datastores.c.

Referenced by clear_dialed_interfaces(), dial_exec_full(), and try_calling().

Initial value:
 {
   .type = "encrypt-call",
   .destroy = secure_call_store_destroy,
   .duplicate = secure_call_store_duplicate,
}

Definition at line 112 of file global_datastores.c.

Referenced by func_channel_read(), func_channel_write_real(), and set_security_requirements().