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