Chapter 37. Functions for Managing RDNs

This chapter contains reference information on RDN routines.

Table 37.1. RDN Routines

Function Description
slapi_rdn_add() Adds a new RDN to an existing RDN structure.
slapi_rdn_compare() Compares two RDNs.
slapi_rdn_contains() Checks if a Slapi_RDN structure holds any RDN matching a give type/value pair.
slapi_rdn_contains_attr() Checks if a Slapi_RDN structure contains any RDN matching a given type.
slapi_rdn_done() Clears a Slapi_RDN structure.
slapi_rdn_free() Frees a Slapi_RDN structure.
slapi_rdn_get_first() Gets the type/value pair of the first RDN.
slapi_rdn_get_index() Gets the index of the RDN.
slapi_rdn_get_index_attr() Gets the position and the attribute value of the first RDN.
slapi_rdn_get_next() Gets the RDN type/value pair from the RDN.
slapi_rdn_get_num_components() Gets the number of RDN type/value pairs.
slapi_rdn_get_rdn() Gets the RDN from a Slapi_RDN structure.
slapi_rdn_get_nrdn() Not implemented; do not use. Gets the normalized RDN from a Slapi_RDN structure.
slapi_rdn_init() Initializes a Slapi_RDN structure.
slapi_rdn_init_dn() Initializes a Slapi_RDN structure with an RDN value taken from a given DN.
slapi_rdn_init_rdn() Initializes a Slapi_RDN structure with an RDN value.
slapi_rdn_init_sdn() Initializes a Slapi_RDN structure with an RDN value taken from the DN contained in a given Slapi_RDN structure.
slapi_rdn_isempty() Checks if an RDN value is stored in a Slapi_RDN structure.
slapi_rdn_new() Allocates a new Slapi_RDN structure.
slapi_rdn_new_dn() Creates a new Slapi_RDN structure.
slapi_rdn_new_rdn() Creates a new Slapi_RDN structure and sets an RDN value.
slapi_rdn_new_sdn() Creates a new Slapi_RDN structure and sets an RDN value taken from the DN contained in a given Slapi_RDN structure.
slapi_rdn_remove() Removes an RDN type/value pair.
slapi_rdn_remove_attr() Removes an RDN type/value pair from a Slapi_RDN structure.
slapi_rdn_remove_index() Removes an RDN type/value pair from a Slapi_RDN structure.
slapi_rdn_set_dn() Sets an RDN value in a Slapi_RDN structure.
slapi_rdn_set_rdn() Sets an RDN in a Slapi_RDN structure.
slapi_rdn_set_sdn() Sets an RDN value in a Slapi_RDN structure.
slapi_sdn_add_rdn() Adds an RDN to a DN.
slapi_rdn2typeval() Converts the second RDN type value to the berval value.

37.1. slapi_rdn_add()

Description

This function adds a new type/value pair to an existing RDN or sets the type/value pair as the new RDN if rdn is empty. This function resets the FLAG_RDNS flags, which means that the RDN array within the Slapi_RDN structure is no longer current with the new RDN.

Syntax

#include "slapi-plugin.h"
int slapi_rdn_add(Slapi_RDN *rdn, const char *type, const char *value);

Parameters

This function takes the following parameters:

rdn
The target Slapi_RDN structure.
type
The type (cn, o, ou, etc.) of the RDN to be added. This parameter cannot be NULL.
value
The value of the RDN to be added. This parameter cannot be NULL.
Returns

This function always returns 1.