00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "asterisk.h"
00027
00028 ASTERISK_FILE_VERSION(__FILE__, "$Revision: 268894 $")
00029
00030 #include "asterisk/global_datastores.h"
00031 #include "asterisk/linkedlists.h"
00032
00033 static void dialed_interface_destroy(void *data)
00034 {
00035 struct ast_dialed_interface *di = NULL;
00036 AST_LIST_HEAD(, ast_dialed_interface) *dialed_interface_list = data;
00037
00038 if (!dialed_interface_list) {
00039 return;
00040 }
00041
00042 AST_LIST_LOCK(dialed_interface_list);
00043 while ((di = AST_LIST_REMOVE_HEAD(dialed_interface_list, list)))
00044 ast_free(di);
00045 AST_LIST_UNLOCK(dialed_interface_list);
00046
00047 AST_LIST_HEAD_DESTROY(dialed_interface_list);
00048 ast_free(dialed_interface_list);
00049 }
00050
00051 static void *dialed_interface_duplicate(void *data)
00052 {
00053 struct ast_dialed_interface *di = NULL;
00054 AST_LIST_HEAD(, ast_dialed_interface) *old_list;
00055 AST_LIST_HEAD(, ast_dialed_interface) *new_list = NULL;
00056
00057 if(!(old_list = data)) {
00058 return NULL;
00059 }
00060
00061 if(!(new_list = ast_calloc(1, sizeof(*new_list)))) {
00062 return NULL;
00063 }
00064
00065 AST_LIST_HEAD_INIT(new_list);
00066 AST_LIST_LOCK(old_list);
00067 AST_LIST_TRAVERSE(old_list, di, list) {
00068 struct ast_dialed_interface *di2 = ast_calloc(1, sizeof(*di2) + strlen(di->interface));
00069 if(!di2) {
00070 AST_LIST_UNLOCK(old_list);
00071 dialed_interface_destroy(new_list);
00072 return NULL;
00073 }
00074 strcpy(di2->interface, di->interface);
00075 AST_LIST_INSERT_TAIL(new_list, di2, list);
00076 }
00077 AST_LIST_UNLOCK(old_list);
00078
00079 return new_list;
00080 }
00081
00082 const struct ast_datastore_info dialed_interface_info = {
00083 .type = "dialed-interface",
00084 .destroy = dialed_interface_destroy,
00085 .duplicate = dialed_interface_duplicate,
00086 };
00087
00088 static void secure_call_store_destroy(void *data)
00089 {
00090 struct ast_secure_call_store *store = data;
00091
00092 ast_free(store);
00093 }
00094
00095 static void *secure_call_store_duplicate(void *data)
00096 {
00097 struct ast_secure_call_store *old = data;
00098 struct ast_secure_call_store *new;
00099
00100 if (!(new = ast_calloc(1, sizeof(*new)))) {
00101 return NULL;
00102 }
00103 new->signaling = old->signaling;
00104 new->media = old->media;
00105
00106 return new;
00107 }
00108 const struct ast_datastore_info secure_call_info = {
00109 .type = "encrypt-call",
00110 .destroy = secure_call_store_destroy,
00111 .duplicate = secure_call_store_duplicate,
00112 };