Show Table of Contents
10.2. Writing Extended Operation Functions
Like other plug-in functions, extended operation functions pass a single parameter block (Slapi_PBlock) and return an integer value, as shown in the following example declaration:
int my_ext_func( Slapi_PBlock *pb );
When the Directory Server receives an extended operation request, the front-end calls the extended operation function with the OID value specified in the request. The front-end makes the following information available to the extended function in the form of parameters in a parameter block.
Table 10.1. Extended Function Parameter Block Arguments
| Parameter ID | Data Type | Description |
|---|---|---|
SLAPI_EXT_OP_REQ_OID | char * | Object ID (OID) of the extended operation specified in the request. |
SLAPI_EXT_OP_REQ_VALUE | struct berval* | Value specified in the request. |
SLAPI_EXT_OP_RET_OID | char * | Object ID (OID) that you want sent back to the client. |
SLAPI_EXT_OP_RET_VALUE | struct berval* | Value that you want sent back to the client. |
Typically, your function should perform an operation on the value specified in the
SLAPI_EXT_OP_REQ_VALUE parameter. After the extended operation completes, your function should return a single value, according to the following:
- If your function has sent a result code back to the client, you should return the value
SLAPI_PLUGIN_EXTENDED_SENT_RESULT. This indicates that the front-end does not need to send a result code. - If your function has not sent a result code back to the client (for example, if the result is
LDAP_SUCCESS), your function should return an LDAP result code. The front-end will send this result code back to the client. - If your function cannot handle the extended operation with the specified OID, your function should return the value
SLAPI_PLUGIN_EXTENDED_NOT_HANDLED. The front-end will send anLDAP_PROTOCOL_ERRORresult code (with anunsupported extended operation error message) back to the client.
Note
Check out the
testextendedop.c source file for a sample plug-in function (uncompiled C code) that implements an extended operation.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.