src/domain.c file

Functions

auto ld_load_config(TALLOC_CTX* ctx, const char* filename) -> ld_config_t*
auto ld_create_config(TALLOC_CTX* talloc_ctx, char* host, int port, int protocol_version, char* base_dn, char* username, char* password, bool simple_bind, bool use_tls, bool use_sasl, bool use_anon, int timeout, char* cacertfile, char* certfile, char* keyfile) -> ld_config_t*
ld_create_config Fills fields of configuration structure.
void ld_init(LDHandle** handle, const ld_config_t* config)
ld_init Initializes the library allowing us to performing various operations.
static void connection_update(verto_ctx* ctx, verto_ev* ev)
void ld_install_default_handlers(LDHandle* handle)
ld_install_default_handlers Installs default handlers to control connection. This method must be called before performing any operations.
void ld_install_handler(LDHandle* handle, verto_callback* callback, time_t interval)
ld_install_handler If we need to install custom error callback this method allows us to do so.
void ld_exec(LDHandle* handle)
ld_exec Start main event cycle. You don't need to call this function if there is already existing event loop e.g. inside of Qt application.
void ld_exec_once(LDHandle* handle)
ld_exec_once Cycles through event list once. May block.
void ld_free(LDHandle* handle)
ld_free Free library handle and resources associated with it. After freeing the handle you can no longer perform any operations.
static auto fill_attributes(LDAPAttribute_t** entry_attrs, TALLOC_CTX* talloc_ctx, int mod_op) -> LDAPMod**
auto ld_add_entry(LDHandle* handle, const char* name, const char* parent, const char* prefix, LDAPAttribute_t** entry_attrs) -> enum OperationReturnCode
ld_add_entry Creates the entry.
auto ld_del_entry(LDHandle* handle, const char* name, const char* parent, const char* prefix) -> enum OperationReturnCode
ld_del_entry Deletes entry.
auto ld_mod_entry(LDHandle* handle, const char* name, const char* parent, const char* prefix, LDAPAttribute_t** entry_attrs) -> enum OperationReturnCode
ld_mod_entry Modifies the entry.
auto ld_rename_entry(LDHandle* handle, const char* old_name, const char* new_name, const char* parent, const char* prefix) -> enum OperationReturnCode
ld_rename_entry Renames the entry.
void ld_install_error_handler(LDHandle* handle, error_callback_fn callback)
ld_install_error_handler Allows us to install custom error handle for our application.
auto ld_mod_entry_attrs(LDHandle* handle, const char* name, const char* parent, const char* prefix, LDAPAttribute_t** entry_attrs, int opcode) -> enum OperationReturnCode
ld_mod_entry_attrs Modifies list of attributes using supplied operation.

Variables

static const int CONNECTION_UPDATE_INTERVAL

Defines

#define get_config_required_string(name, out)
#define get_config_optional_setting(name, out, setting_function, specifier)
#define get_config_optional_string(name, out)
#define get_config_optional_int(name, out)
#define get_config_optional_bool(name, out)

Function documentation

ld_config_t* ld_create_config(TALLOC_CTX* talloc_ctx, char* host, int port, int protocol_version, char* base_dn, char* username, char* password, bool simple_bind, bool use_tls, bool use_sasl, bool use_anon, int timeout, char* cacertfile, char* certfile, char* keyfile)

ld_create_config Fills fields of configuration structure.

Parameters
talloc_ctx
host in Hostname of LDAP server.
port in Port number.
protocol_version in LDAP protocol version.
base_dn in DN to use during bind.
username in Username to use
password in User password
simple_bind in If we going to perform simple bind instead of interactive bind.
use_tls in If we going to use TLS encryption.
use_sasl in If we going to enable SASL.
use_anon in If we going to enable anonymous logon.
timeout in Timeout to read and write operations.
cacertfile in
certfile in
keyfile in
Returns
  • NULL on failure.
  • config_t* on success.

void ld_init(LDHandle** handle, const ld_config_t* config)

ld_init Initializes the library allowing us to performing various operations.

Parameters
handle out Pointer to libdomain session handle.
config in Configuration of the connections.

void ld_install_default_handlers(LDHandle* handle)

ld_install_default_handlers Installs default handlers to control connection. This method must be called before performing any operations.

Parameters
handle in Pointer to libdomain session handle.

void ld_install_handler(LDHandle* handle, verto_callback* callback, time_t interval)

ld_install_handler If we need to install custom error callback this method allows us to do so.

Parameters
handle in Pointer to libdomain session handle.
callback
interval

void ld_exec(LDHandle* handle)

ld_exec Start main event cycle. You don't need to call this function if there is already existing event loop e.g. inside of Qt application.

Parameters
handle in Pointer to libdomain session handle.

void ld_exec_once(LDHandle* handle)

ld_exec_once Cycles through event list once. May block.

Parameters
handle in Pointer to libdomain session handle.

void ld_free(LDHandle* handle)

ld_free Free library handle and resources associated with it. After freeing the handle you can no longer perform any operations.

Parameters
handle in Pointer to libdomain session handle.

enum OperationReturnCode ld_add_entry(LDHandle* handle, const char* name, const char* parent, const char* prefix, LDAPAttribute_t** entry_attrs)

ld_add_entry Creates the entry.

Parameters
handle in Pointer to libdomain session handle.
name in Name of the entry.
parent in Parent container that holds the entry.
prefix
entry_attrs in List of the attributes to create entry with.
Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_FAILURE on failure.

enum OperationReturnCode ld_del_entry(LDHandle* handle, const char* name, const char* parent, const char* prefix)

ld_del_entry Deletes entry.

Parameters
handle in Pointer to libdomain session handle.
name in Name of the entry.
parent in Parent container that holds the entry.
prefix in Prefix of the entry.
Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_FAILURE on failure.

enum OperationReturnCode ld_mod_entry(LDHandle* handle, const char* name, const char* parent, const char* prefix, LDAPAttribute_t** entry_attrs)

ld_mod_entry Modifies the entry.

Parameters
handle in Pointer to libdomain session handle.
name in Name of the entry.
parent in Parent container that holds the entry.
prefix
entry_attrs in List of the attributes to modify.
Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_FAILURE on failure.

enum OperationReturnCode ld_rename_entry(LDHandle* handle, const char* old_name, const char* new_name, const char* parent, const char* prefix)

ld_rename_entry Renames the entry.

Parameters
handle in Pointer to libdomain session handle.
old_name in Old name of the entry.
new_name in New name of the entry.
parent in Parent container that holds the entry.
prefix in Prefix for entry type.
Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_FAILURE on failure.

void ld_install_error_handler(LDHandle* handle, error_callback_fn callback)

ld_install_error_handler Allows us to install custom error handle for our application.

Parameters
handle in Pointer to libdomain session handle.
callback in Callback to call.

enum OperationReturnCode ld_mod_entry_attrs(LDHandle* handle, const char* name, const char* parent, const char* prefix, LDAPAttribute_t** entry_attrs, int opcode)

ld_mod_entry_attrs Modifies list of attributes using supplied operation.

Parameters
handle in Pointer to libdomain session handle.
name in Name of the entry.
parent in Parent container that holds the entry.
prefix in Prefix of the entry.
entry_attrs in List of the attributes to modify.
opcode in Code of operation e.g. LDAP_MOD_REPLACE.
Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_FAILURE on failure.