global_datastores.c File Reference

globally-accessible datastore information and callbacks More...

#include "asterisk.h"
#include "asterisk/global_datastores.h"
#include "asterisk/linkedlists.h"

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, ast_dialed_interface::list, and NULL.

Referenced by dialed_interface_duplicate().

00038 {
00039    struct ast_dialed_interface *di = NULL;
00040    AST_LIST_HEAD(, ast_dialed_interface) *dialed_interface_list = data;
00041    
00042    if (!dialed_interface_list) {
00043       return;
00044    }
00045 
00046    AST_LIST_LOCK(dialed_interface_list);
00047    while ((di = AST_LIST_REMOVE_HEAD(dialed_interface_list, list)))
00048       ast_free(di);
00049    AST_LIST_UNLOCK(dialed_interface_list);
00050 
00051    AST_LIST_HEAD_DESTROY(dialed_interface_list);
00052    ast_free(dialed_interface_list);
00053 }

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, ast_dialed_interface::list, and NULL.

00056 {
00057    struct ast_dialed_interface *di = NULL;
00058    AST_LIST_HEAD(, ast_dialed_interface) *old_list;
00059    AST_LIST_HEAD(, ast_dialed_interface) *new_list = NULL;
00060 
00061    if(!(old_list = data)) {
00062       return NULL;
00063    }
00064 
00065    if(!(new_list = ast_calloc(1, sizeof(*new_list)))) {
00066       return NULL;
00067    }
00068 
00069    AST_LIST_HEAD_INIT(new_list);
00070    AST_LIST_LOCK(old_list);
00071    AST_LIST_TRAVERSE(old_list, di, list) {
00072       struct ast_dialed_interface *di2 = ast_calloc(1, sizeof(*di2) + strlen(di->interface));
00073       if(!di2) {
00074          AST_LIST_UNLOCK(old_list);
00075          dialed_interface_destroy(new_list);
00076          return NULL;
00077       }
00078       strcpy(di2->interface, di->interface);
00079       AST_LIST_INSERT_TAIL(new_list, di2, list);
00080    }
00081    AST_LIST_UNLOCK(old_list);
00082 
00083    return new_list;
00084 }

static void secure_call_store_destroy ( void *  data  )  [static]

Definition at line 92 of file global_datastores.c.

References ast_free.

00093 {
00094    struct ast_secure_call_store *store = data;
00095 
00096    ast_free(store);
00097 }

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, NULL, and ast_secure_call_store::signaling.

00100 {
00101    struct ast_secure_call_store *old = data;
00102    struct ast_secure_call_store *new;
00103 
00104    if (!(new = ast_calloc(1, sizeof(*new)))) {
00105       return NULL;
00106    }
00107    new->signaling = old->signaling;
00108    new->media = old->media;
00109 
00110    return new;
00111 }


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().


Generated on Thu Apr 16 06:31:29 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6