1<?php
2/**
3 * This file is part of the FreeDSx LDAP package.
4 *
5 * (c) Chad Sikorra <Chad.Sikorra@gmail.com>
6 *
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
9 */
10
11namespace FreeDSx\Ldap\Server\RequestHandler;
12
13use FreeDSx\Ldap\Entry\Entries;
14use FreeDSx\Ldap\Exception\OperationException;
15use FreeDSx\Ldap\Operation\Request\AddRequest;
16use FreeDSx\Ldap\Operation\Request\CompareRequest;
17use FreeDSx\Ldap\Operation\Request\DeleteRequest;
18use FreeDSx\Ldap\Operation\Request\ExtendedRequest;
19use FreeDSx\Ldap\Operation\Request\ModifyDnRequest;
20use FreeDSx\Ldap\Operation\Request\ModifyRequest;
21use FreeDSx\Ldap\Operation\Request\SearchRequest;
22use FreeDSx\Ldap\Server\RequestContext;
23
24/**
25 * Handler methods for LDAP server requests.
26 *
27 * @author Chad Sikorra <Chad.Sikorra@gmail.com>
28 */
29interface RequestHandlerInterface
30{
31    /**
32     * An add request.
33     *
34     * @throws OperationException
35     */
36    public function add(RequestContext $context, AddRequest $add): void;
37
38    /**
39     * A compare request. This should return true or false for whether the compare matches or not.
40     *
41     * @throws OperationException
42     */
43    public function compare(RequestContext $context, CompareRequest $compare): bool;
44
45    /**
46     * A delete request.
47     *
48     * @throws OperationException
49     */
50    public function delete(RequestContext $context, DeleteRequest $delete): void;
51
52    /**
53     * An extended operation request.
54     *
55     * @throws OperationException
56     */
57    public function extended(RequestContext $context, ExtendedRequest $extended): void;
58
59    /**
60     * A request to modify an entry.
61     *
62     * @throws OperationException
63     */
64    public function modify(RequestContext $context, ModifyRequest $modify): void;
65
66    /**
67     * A request to modify the DN of an entry.
68     *
69     * @throws OperationException
70     */
71    public function modifyDn(RequestContext $context, ModifyDnRequest $modifyDn): void;
72
73    /**
74     * A search request. This should return an entries collection object.
75     *
76     * @throws OperationException
77     */
78    public function search(RequestContext $context, SearchRequest $search): Entries;
79
80    /**
81     * A simple username/password bind. It should simply return true or false for whether the username and password is
82     * valid. You can also throw an operations exception, which is implicitly false, and provide an additional result
83     * code and diagnostics.
84     *
85     * @throws OperationException
86     */
87    public function bind(string $username, string $password): bool;
88}
89