1e9b52b79SMike Goldsmithusing System;
2c78c72e1Sjeffrymorris
3e308481bSJeff Morrisnamespace Couchbase.Core.IO.Operations.Authentication
4c78c72e1Sjeffrymorris{
585b1ae52Sjeffrymorris    /// <summary>
685b1ae52Sjeffrymorris    /// Starts the SASL authentication process using a specified SASL mechanism type as a key.
785b1ae52Sjeffrymorris    /// </summary>
89260824bSJeff Morris    // ReSharper disable once IdentifierTypo
9a042d8b5Sjeffrymorris    internal class SaslStart : OperationBase<string>
10c78c72e1Sjeffrymorris    {
1143cf091cSMike Goldsmith        public override OpCode OpCode => OpCode.SaslStart;
12c78c72e1Sjeffrymorris
131a28374eSBrant Burnett        protected override void WriteExtras(OperationBuilder builder)
1421843b11SBrant Burnett        {
1521843b11SBrant Burnett        }
1621843b11SBrant Burnett
171a28374eSBrant Burnett        protected override void ReadExtras(ReadOnlySpan<byte> buffer)
1872b06be3Sjeffrymorris        {
1972b06be3Sjeffrymorris            Flags = new Flags
2072b06be3Sjeffrymorris            {
2172b06be3Sjeffrymorris                Compression = Compression.None,
221a28374eSBrant Burnett                DataFormat = Flags.DataFormat,
2372b06be3Sjeffrymorris                TypeCode = TypeCode.String
2472b06be3Sjeffrymorris            };
25150a9956SJeff Morris
26150a9956SJeff Morris            TryReadServerDuration(buffer);
2772b06be3Sjeffrymorris        }
2872b06be3Sjeffrymorris
2921843b11SBrant Burnett        protected override void BeginSend()
3072b06be3Sjeffrymorris        {
3172b06be3Sjeffrymorris            Flags = new Flags
3272b06be3Sjeffrymorris            {
3372b06be3Sjeffrymorris                Compression = Compression.None,
341a28374eSBrant Burnett                DataFormat = Flags.DataFormat,
3572b06be3Sjeffrymorris                TypeCode = TypeCode.String
3672b06be3Sjeffrymorris            };
3772b06be3Sjeffrymorris        }
3872b06be3Sjeffrymorris
39c78c72e1Sjeffrymorris        /*Field (offset) (value)
40c78c72e1Sjeffrymorris            Magic (0): 0x80 (PROTOCOL_BINARY_REQ)
41c78c72e1Sjeffrymorris            Opcode (1): 0x21 (sasl auth)
42c78c72e1Sjeffrymorris            Key length (2-3): 0x0005 (5)
43c78c72e1Sjeffrymorris            Extra length (4): 0x00
44c78c72e1Sjeffrymorris            Data type (5): 0x00
45c78c72e1Sjeffrymorris            vBucket (6-7): 0x0000 (0)
46c78c72e1Sjeffrymorris            Total body (8-11): 0x00000010 (16)
47c78c72e1Sjeffrymorris            Opaque (12-15): 0x00000000 (0)
48c78c72e1Sjeffrymorris            CAS (16-23): 0x0000000000000000 (0)
49c78c72e1Sjeffrymorris            Mechanisms (24-28): PLAIN
50c78c72e1Sjeffrymorris            Auth token (29-39): foo0x00foo0x00bar
518108e5a6Sjeffrymorris        */
52c78c72e1Sjeffrymorris    }
53c78c72e1Sjeffrymorris}
541c16121dSjeffrymorris
551c16121dSjeffrymorris#region [ License information          ]
561c16121dSjeffrymorris
571c16121dSjeffrymorris/* ************************************************************
581c16121dSjeffrymorris *
591c16121dSjeffrymorris *    @author Couchbase <info@couchbase.com>
601c16121dSjeffrymorris *    @copyright 2014 Couchbase, Inc.
611c16121dSjeffrymorris *
621c16121dSjeffrymorris *    Licensed under the Apache License, Version 2.0 (the "License");
631c16121dSjeffrymorris *    you may not use this file except in compliance with the License.
641c16121dSjeffrymorris *    You may obtain a copy of the License at
651c16121dSjeffrymorris *
661c16121dSjeffrymorris *        http://www.apache.org/licenses/LICENSE-2.0
671c16121dSjeffrymorris *
681c16121dSjeffrymorris *    Unless required by applicable law or agreed to in writing, software
691c16121dSjeffrymorris *    distributed under the License is distributed on an "AS IS" BASIS,
701c16121dSjeffrymorris *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
711c16121dSjeffrymorris *    See the License for the specific language governing permissions and
721c16121dSjeffrymorris *    limitations under the License.
731c16121dSjeffrymorris *
741c16121dSjeffrymorris * ************************************************************/
751c16121dSjeffrymorris
766e97fb87SMike Goldsmith#endregion [ License information          ]
77