Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

Directory Service Functions
[Core Library]


Functions

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 switch_core_directory_query (switch_directory_handle_t *dh, char *base, char *query)
 Query a directory handle.
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_next_pair (switch_directory_handle_t *dh, char **var, char **val)
 Obtain the next name/value pair in the current record.
switch_status_t switch_core_directory_close (switch_directory_handle_t *dh)
 Close an open directory handle.


Function Documentation

switch_status_t switch_core_directory_close switch_directory_handle_t dh  ) 
 

Close an open directory handle.

Parameters:
dh a direcotry handle to close
Returns:
SWITCH_STATUS_SUCCESS if handle was closed
00076 {
00077         switch_status_t status;
00078 
00079         status = dh->directory_interface->directory_close(dh);
00080 
00081         if (switch_test_flag(dh, SWITCH_DIRECTORY_FLAG_FREE_POOL)) {
00082                 switch_core_destroy_memory_pool(&dh->memory_pool);
00083         }
00084 
00085         return status;
00086 }

switch_status_t switch_core_directory_next switch_directory_handle_t dh  ) 
 

Obtain the next record in a lookup.

Parameters:
dh a direcotry handle to use
Returns:
SWITCH_STATUS_SUCCESS if another record exists
00066 {
00067         return dh->directory_interface->directory_next(dh);
00068 }

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.

Parameters:
dh a direcotry handle to use
var a pointer to pointer of the name to fill in
val a pointer to poinbter of the value to fill in
Returns:
SWITCH_STATUS_SUCCESS if an item exists
00071 {
00072         return dh->directory_interface->directory_next_pair(dh, var, val);
00073 }

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.

Parameters:
dh a direcotry handle to use
module_name the directory module to use
source the source of the db (ip, hostname, path etc)
dsn the username or designation of the lookup
passwd the password
pool the pool to use (NULL for new pool)
Returns:
SWITCH_STATUS_SUCCESS if the handle is opened
00040 {
00041         switch_status_t status;
00042 
00043         if ((dh->directory_interface = switch_loadable_module_get_directory_interface(module_name)) == 0) {
00044                 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "invalid directory module [%s]!\n", module_name);
00045                 return SWITCH_STATUS_GENERR;
00046         }
00047 
00048         if (pool) {
00049                 dh->memory_pool = pool;
00050         } else {
00051                 if ((status = switch_core_new_memory_pool(&dh->memory_pool)) != SWITCH_STATUS_SUCCESS) {
00052                         return status;
00053                 }
00054                 switch_set_flag(dh, SWITCH_DIRECTORY_FLAG_FREE_POOL);
00055         }
00056 
00057         return dh->directory_interface->directory_open(dh, source, dsn, passwd);
00058 }

Here is the call graph for this function:

switch_status_t switch_core_directory_query switch_directory_handle_t dh,
char *  base,
char *  query
 

Query a directory handle.

Parameters:
dh a direcotry handle to use
base the base to query against
query a string of filters or query data
Returns:
SWITCH_STATUS_SUCCESS if the query is successful
00061 {
00062         return dh->directory_interface->directory_query(dh, base, query);
00063 }


Generated on Fri Oct 10 11:24:33 2008 for FreeSWITCH by  doxygen 1.3.9.1