xref: /plugin/pureldap/vendor/freedsx/sasl/src/FreeDSx/Sasl/Encoder/EncoderInterface.php (revision 0b3fd2d31e4d1997548a8fbc53fa771027c4a47f)
1*0b3fd2d3SAndreas Gohr<?php
2*0b3fd2d3SAndreas Gohr
3*0b3fd2d3SAndreas Gohr/**
4*0b3fd2d3SAndreas Gohr * This file is part of the FreeDSx SASL package.
5*0b3fd2d3SAndreas Gohr *
6*0b3fd2d3SAndreas Gohr * (c) Chad Sikorra <Chad.Sikorra@gmail.com>
7*0b3fd2d3SAndreas Gohr *
8*0b3fd2d3SAndreas Gohr * For the full copyright and license information, please view the LICENSE
9*0b3fd2d3SAndreas Gohr * file that was distributed with this source code.
10*0b3fd2d3SAndreas Gohr */
11*0b3fd2d3SAndreas Gohr
12*0b3fd2d3SAndreas Gohrnamespace FreeDSx\Sasl\Encoder;
13*0b3fd2d3SAndreas Gohr
14*0b3fd2d3SAndreas Gohruse FreeDSx\Sasl\Exception\SaslEncodingException;
15*0b3fd2d3SAndreas Gohruse FreeDSx\Sasl\Message;
16*0b3fd2d3SAndreas Gohruse FreeDSx\Sasl\SaslContext;
17*0b3fd2d3SAndreas Gohr
18*0b3fd2d3SAndreas Gohr/**
19*0b3fd2d3SAndreas Gohr * The SASL client.
20*0b3fd2d3SAndreas Gohr *
21*0b3fd2d3SAndreas Gohr * @author Chad Sikorra <Chad.Sikorra@gmail.com>
22*0b3fd2d3SAndreas Gohr */
23*0b3fd2d3SAndreas Gohrinterface EncoderInterface
24*0b3fd2d3SAndreas Gohr{
25*0b3fd2d3SAndreas Gohr    /**
26*0b3fd2d3SAndreas Gohr     * Encode a message object to a string. Optionally pass the type of message to be encoded.
27*0b3fd2d3SAndreas Gohr     *
28*0b3fd2d3SAndreas Gohr     * @throws SaslEncodingException
29*0b3fd2d3SAndreas Gohr     */
30*0b3fd2d3SAndreas Gohr    public function encode(Message $message, SaslContext $context): string;
31*0b3fd2d3SAndreas Gohr
32*0b3fd2d3SAndreas Gohr    /**
33*0b3fd2d3SAndreas Gohr     * Decode a string to a message object. Optionally pass the type of message to be decoded.
34*0b3fd2d3SAndreas Gohr     *
35*0b3fd2d3SAndreas Gohr     * @throws SaslEncodingException
36*0b3fd2d3SAndreas Gohr     */
37*0b3fd2d3SAndreas Gohr    public function decode(string $data, SaslContext $context): Message;
38*0b3fd2d3SAndreas Gohr}
39