RTS API Documentation  1.10.11
switch_core_directory.c
Go to the documentation of this file.
1 /*
2  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
3  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
4  *
5  * Version: MPL 1.1
6  *
7  * The contents of this file are subject to the Mozilla Public License Version
8  * 1.1 (the "License"); you may not use this file except in compliance with
9  * the License. You may obtain a copy of the License at
10  * http://www.mozilla.org/MPL/
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14  * for the specific language governing rights and limitations under the
15  * License.
16  *
17  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
18  *
19  * The Initial Developer of the Original Code is
20  * Anthony Minessale II <anthm@freeswitch.org>
21  * Portions created by the Initial Developer are Copyright (C)
22  * the Initial Developer. All Rights Reserved.
23  *
24  * Contributor(s):
25  *
26  * Anthony Minessale II <anthm@freeswitch.org>
27  * Michael Jerris <mike@jerris.com>
28  * Paul D. Tinsley <pdt at jackhammer.org>
29  *
30  *
31  * switch_core_directory.c -- Main Core Library (Directory Interface)
32  *
33  */
34 
35 #include <switch.h>
37 
39  char *module_name, char *source, char *dsn, char *passwd, switch_memory_pool_t *pool)
40 {
41  switch_status_t status;
42 
44  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid directory module [%s]!\n", module_name);
45  return SWITCH_STATUS_GENERR;
46  }
47 
48  if (pool) {
49  dh->memory_pool = pool;
50  } else {
53  return status;
54  }
56  }
57 
58  return dh->directory_interface->directory_open(dh, source, dsn, passwd);
59 }
60 
62 {
63  return dh->directory_interface->directory_query(dh, base, query);
64 }
65 
67 {
68  return dh->directory_interface->directory_next(dh);
69 }
70 
72 {
73  return dh->directory_interface->directory_next_pair(dh, var, val);
74 }
75 
77 {
78  switch_status_t status;
79 
80  status = dh->directory_interface->directory_close(dh);
82 
85  }
86 
87  return status;
88 }
89 
90 /* For Emacs:
91  * Local Variables:
92  * mode:c
93  * indent-tabs-mode:t
94  * tab-width:4
95  * c-basic-offset:4
96  * End:
97  * For VIM:
98  * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
99  */
#define switch_core_new_memory_pool(p)
Create a new sub memory pool from the core&#39;s master pool.
Definition: switch_core.h:633
#define switch_set_flag(obj, flag)
Set a flag on an arbitrary object.
Definition: switch_utils.h:700
#define SWITCH_CHANNEL_LOG
switch_status_t switch_core_directory_query(switch_directory_handle_t *dh, char *base, char *query)
Query a directory handle.
switch_directory_interface_t * directory_interface
switch_status_t(* directory_next_pair)(switch_directory_handle_t *dh, char **var, char **val)
switch_directory_interface_t * switch_loadable_module_get_directory_interface(const char *name)
Retrieve the directory interface by it&#39;s registered name.
#define switch_core_destroy_memory_pool(p)
Returns a subpool back to the main pool.
Definition: switch_core.h:642
switch_memory_pool_t * pool
switch_memory_pool_t * memory_pool
#define UNPROTECT_INTERFACE(_it)
switch_status_t switch_core_directory_next(switch_directory_handle_t *dh)
Obtain the next record in a lookup.
switch_status_t switch_core_directory_close(switch_directory_handle_t *dh)
Close an open directory handle.
switch_status_t(* directory_close)(switch_directory_handle_t *dh)
switch_status_t switch_core_directory_open(switch_directory_handle_t *dh, char *module_name, char *source, char *dsn, char *passwd, switch_memory_pool_t *pool)
Open a directory handle.
switch_status_t(* directory_query)(switch_directory_handle_t *dh, char *base, char *query)
switch_status_t(* directory_open)(switch_directory_handle_t *dh, char *source, char *dsn, char *passwd)
switch_status_t
Common return values.
switch_status_t switch_core_directory_next_pair(switch_directory_handle_t *dh, char **var, char **val)
Obtain the next name/value pair in the current record.
Main Library Header.
#define SWITCH_DECLARE(type)
#define switch_test_flag(obj, flag)
Test for the existance of a flag on an arbitary object.
Definition: switch_utils.h:693
void switch_log_printf(_In_ switch_text_channel_t channel, _In_z_ const char *file, _In_z_ const char *func, _In_ int line, _In_opt_z_ const char *userdata, _In_ switch_log_level_t level, _In_z_ _Printf_format_string_ const char *fmt,...) PRINTF_FUNCTION(7
Write log data to the logging engine.
struct fspr_pool_t switch_memory_pool_t
switch_status_t(* directory_next)(switch_directory_handle_t *dh)