Sun Java System Directory Server Enterprise Edition 6.0 Developer's Guide

slapi_build_control()

Creates an LDAPControl structure based on a BerElement, an OID, and a criticality flag.

Syntax

#include "slapi-plugin.h"
int slapi_build_control( char const *oid, BerElement const *ber,
    char iscritical, LDAPControl **ctrlp );

Parameters

This function takes the following parameters:

oid

The OID (object identifier) for the control that is to be created.

ber

A BerElement that contains the control value. Pass NULL if the control has no value.

iscritical

The criticality flag. If non-zero, the control will be marked as critical. If 0, it will not be marked as critical.

ctrlp

Pointer that will receive the allocated LDAPControl structure.

Returns

This function returns LDAP_SUCCESS (LDAP result code) if successful.

Description

This function creates an LDAPControl structure based on a BerElement, an OID, and a criticality flag. The LDAPControl that is created can be used in LDAP client requests or internal operations.

You can construct a BerElement using ber_init(3LDAP) for example.

Memory Concerns

Directory Server makes a copy of the oid string.

The contents of the ber parameter are consumed by this function. Because of this, the caller should not free the BerElement once a successful call has been made to slapi_build_control().

The LDAPControl pointer that is returned in ctrlp should be freed by calling ldap_control_free(3LDAP), which is an LDAP API function.

See Also

ber_init(3LDAP)
ldap_control_free(3LDAP)

slapi_build_control_from_berval()