Netscape DIRECTORY SERVER 6.1 - PLUG-IN Manual page 423

Table of Contents

Advertisement

int connid = 0;
...
retval = slapi_pblock_get(pb, SLAPI_CONN_ID, &connid);
is an integer value, so you will pass in a pointer to/address of an
SLAPI_CONN_ID
integer to get the value. Similarly, for a char
to/address of the value. For example:
char *binddn = NULL;
...
retval = slapi_pblock_get(pb, SLAPI_CONN_DN, &binddn);
With certain compilers on some platforms, you may have to cast the value to
.
*)
We recommend that you set the value to
slapi_pblock_get()
to
slapi_pblock_get()
In most instances, the caller should not free the returned value. The value will
usually be freed internally or through the call to
exception is if the value is explicitly set by the caller through
In this case, the caller is responsible for memory management. If the value is freed,
it is strongly recommended that the free is followed by a call to
slapi_pblock_set()
char *someparam = NULL;
...
someparam = slapi_ch_strdup(somestring);
slapi_pblock_set(pb, SOME_PARAM, someparam);
someparam = NULL; /* avoid dangling reference */
...
slapi_pblock_get(pb, SOME_PARAM, &someparam);
slapi_pblock_set(pb, SOME_PARAM, NULL); /* make sure no one else can
reference this parameter */
slapi_ch_free_string(&someparam);
...
Some internal functions may change the value passed in, so it is recommended to
use
slapi_pblock_get()
potential dangling pointer. This is shown in the example above, which sets
to
after setting it in the
someparam
NULL
or
0
to avoid reading from uninitialized memory, in case the call
fails.
with a value of
. For example:
NULL
to retrieve the value again, rather than relying on a
pblock
Functions for Managing Parameter Block
(a string), pass in a pointer
* value
before calling
NULL
slapi_pblock_destroy()
slapi_pblock_set()
.
Chapter 15
Function Reference
(void
. The
.
423

Advertisement

Table of Contents
loading

This manual is also suitable for:

Directory server 6.1

Table of Contents