RTS API Documentation  1.10.11
Functions
Directory Service Functions
+ 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. More...
 
switch_status_t switch_core_directory_query (switch_directory_handle_t *dh, char *base, char *query)
 Query a directory handle. More...
 
switch_status_t switch_core_directory_next (switch_directory_handle_t *dh)
 Obtain the next record in a lookup. More...
 
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. More...
 
switch_status_t switch_core_directory_close (switch_directory_handle_t *dh)
 Close an open directory handle. More...
 

Detailed Description

Function Documentation

◆ switch_core_directory_close()

switch_status_t switch_core_directory_close ( switch_directory_handle_t dh)

Close an open directory handle.

Parameters
dha directory handle to close
Returns
SWITCH_STATUS_SUCCESS if handle was closed

Definition at line 76 of file switch_core_directory.c.

References switch_directory_interface::directory_close, switch_directory_handle::directory_interface, switch_directory_handle::memory_pool, switch_core_destroy_memory_pool, SWITCH_DIRECTORY_FLAG_FREE_POOL, switch_test_flag, and UNPROTECT_INTERFACE.

77 {
78  switch_status_t status;
79 
80  status = dh->directory_interface->directory_close(dh);
82 
85  }
86 
87  return status;
88 }
switch_directory_interface_t * directory_interface
#define switch_core_destroy_memory_pool(p)
Returns a subpool back to the main pool.
Definition: switch_core.h:642
switch_memory_pool_t * memory_pool
#define UNPROTECT_INTERFACE(_it)
switch_status_t(* directory_close)(switch_directory_handle_t *dh)
switch_status_t
Common return values.
#define switch_test_flag(obj, flag)
Test for the existance of a flag on an arbitary object.
Definition: switch_utils.h:693

◆ switch_core_directory_next()

switch_status_t switch_core_directory_next ( switch_directory_handle_t dh)

Obtain the next record in a lookup.

Parameters
dha directory handle to use
Returns
SWITCH_STATUS_SUCCESS if another record exists

Definition at line 66 of file switch_core_directory.c.

References switch_directory_handle::directory_interface, and switch_directory_interface::directory_next.

67 {
68  return dh->directory_interface->directory_next(dh);
69 }
switch_directory_interface_t * directory_interface
switch_status_t(* directory_next)(switch_directory_handle_t *dh)

◆ switch_core_directory_next_pair()

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
dha directory handle to use
vara pointer to pointer of the name to fill in
vala 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.

References switch_directory_handle::directory_interface, and switch_directory_interface::directory_next_pair.

72 {
73  return dh->directory_interface->directory_next_pair(dh, var, val);
74 }
switch_directory_interface_t * directory_interface
switch_status_t(* directory_next_pair)(switch_directory_handle_t *dh, char **var, char **val)

◆ switch_core_directory_open()

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
dha directory handle to use
module_namethe directory module to use
sourcethe source of the db (ip, hostname, path etc)
dsnthe username or designation of the lookup
passwdthe password
poolthe 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_directory_handle::directory_interface, switch_directory_interface::directory_open, switch_directory_handle::memory_pool, pool, 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.

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 }
#define switch_core_new_memory_pool(p)
Create a new sub memory pool from the core'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_directory_interface_t * directory_interface
switch_directory_interface_t * switch_loadable_module_get_directory_interface(const char *name)
Retrieve the directory interface by it's registered name.
switch_memory_pool_t * pool
switch_memory_pool_t * memory_pool
#define UNPROTECT_INTERFACE(_it)
switch_status_t(* directory_open)(switch_directory_handle_t *dh, char *source, char *dsn, char *passwd)
switch_status_t
Common return values.
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.

◆ switch_core_directory_query()

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

Query a directory handle.

Parameters
dha directory handle to use
basethe base to query against
querya 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.

References switch_directory_handle::directory_interface, and switch_directory_interface::directory_query.

62 {
63  return dh->directory_interface->directory_query(dh, base, query);
64 }
switch_directory_interface_t * directory_interface
switch_status_t(* directory_query)(switch_directory_handle_t *dh, char *base, char *query)