Directory Service Functions
[Core Library]

Collaboration diagram for Directory Service Functions:

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 directory handle to close
Returns:
SWITCH_STATUS_SUCCESS if handle was closed

Definition at line 76 of file switch_core_directory.c.

References switch_core_destroy_memory_pool, SWITCH_DIRECTORY_FLAG_FREE_POOL, switch_test_flag, and UNPROTECT_INTERFACE.

00077 {
00078         switch_status_t status;
00079 
00080         status = dh->directory_interface->directory_close(dh);
00081         UNPROTECT_INTERFACE(dh->directory_interface);
00082 
00083         if (switch_test_flag(dh, SWITCH_DIRECTORY_FLAG_FREE_POOL)) {
00084                 switch_core_destroy_memory_pool(&dh->memory_pool);
00085         }
00086 
00087         return status;
00088 }

switch_status_t switch_core_directory_next ( switch_directory_handle_t dh  ) 

Obtain the next record in a lookup.

Parameters:
dh a directory handle to use
Returns:
SWITCH_STATUS_SUCCESS if another record exists

Definition at line 66 of file switch_core_directory.c.

00067 {
00068         return dh->directory_interface->directory_next(dh);
00069 }

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 directory handle to use
var a pointer to pointer of the name to fill in
val a pointer to pointer of the value to fill in
Returns:
SWITCH_STATUS_SUCCESS if an item exists

Definition at line 71 of file switch_core_directory.c.

00072 {
00073         return dh->directory_interface->directory_next_pair(dh, var, val);
00074 }

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 directory 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

Definition at line 38 of file switch_core_directory.c.

References SWITCH_CHANNEL_LOG, switch_core_new_memory_pool, SWITCH_DIRECTORY_FLAG_FREE_POOL, switch_loadable_module_get_directory_interface(), SWITCH_LOG_ERROR, switch_log_printf(), switch_set_flag, SWITCH_STATUS_GENERR, SWITCH_STATUS_SUCCESS, and UNPROTECT_INTERFACE.

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                         UNPROTECT_INTERFACE(dh->directory_interface);
00053                         return status;
00054                 }
00055                 switch_set_flag(dh, SWITCH_DIRECTORY_FLAG_FREE_POOL);
00056         }
00057 
00058         return dh->directory_interface->directory_open(dh, source, dsn, passwd);
00059 }

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

Query a directory handle.

Parameters:
dh a directory 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

Definition at line 61 of file switch_core_directory.c.

00062 {
00063         return dh->directory_interface->directory_query(dh, base, query);
00064 }


Generated on Wed May 16 04:00:18 2012 for FreeSWITCH API Documentation by  doxygen 1.4.7