Wed Jan 8 2020 09:50:13

Asterisk developer's documentation


global_datastores.c File Reference

globally-accessible datastore information and callbacks More...

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 mmich.nosp@m.elso.nosp@m.n@dig.nosp@m.ium..nosp@m.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().

38 {
39  struct ast_dialed_interface *di = NULL;
40  AST_LIST_HEAD(, ast_dialed_interface) *dialed_interface_list = data;
41 
42  if (!dialed_interface_list) {
43  return;
44  }
45 
46  AST_LIST_LOCK(dialed_interface_list);
47  while ((di = AST_LIST_REMOVE_HEAD(dialed_interface_list, list)))
48  ast_free(di);
49  AST_LIST_UNLOCK(dialed_interface_list);
50 
51  AST_LIST_HEAD_DESTROY(dialed_interface_list);
52  ast_free(dialed_interface_list);
53 }
#define AST_LIST_LOCK(head)
Locks a list.
Definition: linkedlists.h:39
#define AST_LIST_HEAD(name, type)
Defines a structure to be used to hold a list of specified type.
Definition: linkedlists.h:172
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
Definition: linkedlists.h:139
#define AST_LIST_HEAD_DESTROY(head)
Destroys a list head structure.
Definition: linkedlists.h:638
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
Definition: linkedlists.h:818
static float di[4]
Definition: tdd.c:59
struct ast_dialed_interface::@174 list
#define ast_free(a)
Definition: astmm.h:97
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.

56 {
57  struct ast_dialed_interface *di = NULL;
59  AST_LIST_HEAD(, ast_dialed_interface) *new_list = NULL;
60 
61  if(!(old_list = data)) {
62  return NULL;
63  }
64 
65  if(!(new_list = ast_calloc(1, sizeof(*new_list)))) {
66  return NULL;
67  }
68 
69  AST_LIST_HEAD_INIT(new_list);
70  AST_LIST_LOCK(old_list);
71  AST_LIST_TRAVERSE(old_list, di, list) {
72  struct ast_dialed_interface *di2 = ast_calloc(1, sizeof(*di2) + strlen(di->interface));
73  if(!di2) {
74  AST_LIST_UNLOCK(old_list);
75  dialed_interface_destroy(new_list);
76  return NULL;
77  }
78  strcpy(di2->interface, di->interface);
79  AST_LIST_INSERT_TAIL(new_list, di2, list);
80  }
81  AST_LIST_UNLOCK(old_list);
82 
83  return new_list;
84 }
#define AST_LIST_LOCK(head)
Locks a list.
Definition: linkedlists.h:39
#define AST_LIST_HEAD(name, type)
Defines a structure to be used to hold a list of specified type.
Definition: linkedlists.h:172
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
Definition: linkedlists.h:139
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
Definition: linkedlists.h:716
static float di[4]
Definition: tdd.c:59
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:490
struct ast_dialed_interface::@174 list
#define AST_LIST_HEAD_INIT(head)
Initializes a list head structure.
Definition: linkedlists.h:611
#define ast_calloc(a, b)
Definition: astmm.h:82
static void dialed_interface_destroy(void *data)
static void secure_call_store_destroy ( void *  data)
static

Definition at line 92 of file global_datastores.c.

References ast_free.

93 {
94  struct ast_secure_call_store *store = data;
95 
96  ast_free(store);
97 }
#define ast_free(a)
Definition: astmm.h:97
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.

100 {
101  struct ast_secure_call_store *old = data;
102  struct ast_secure_call_store *new;
103 
104  if (!(new = ast_calloc(1, sizeof(*new)))) {
105  return NULL;
106  }
107  new->signaling = old->signaling;
108  new->media = old->media;
109 
110  return new;
111 }
#define ast_calloc(a, b)
Definition: astmm.h:82

Variable Documentation

struct ast_datastore_info dialed_interface_info
Initial value:
= {
.type = "dialed-interface",
}
static void * dialed_interface_duplicate(void *data)
static void dialed_interface_destroy(void *data)

Definition at line 86 of file global_datastores.c.

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

struct ast_datastore_info secure_call_info
Initial value:
= {
.type = "encrypt-call",
}
static void secure_call_store_destroy(void *data)
static void * secure_call_store_duplicate(void *data)

Definition at line 112 of file global_datastores.c.

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