From 8f5ccec205ae6897023ca37a4854b7436358bea4 Mon Sep 17 00:00:00 2001 From: bollhals Date: Thu, 13 Aug 2020 00:03:41 +0200 Subject: [PATCH 1/4] remove APIGen project --- RabbitMQDotNetClient.sln | 6 - build.bat | 1 - projects/Apigen/Apigen.csproj | 12 - projects/Apigen/apigen/AmqpEntity.cs | 83 - projects/Apigen/apigen/Apigen.cs | 1460 ----------------- .../RabbitMQ.Client/RabbitMQ.Client.csproj | 1 - .../client/framing/BasicAck.cs | 84 + .../client/framing/BasicCancel.cs | 85 + .../client/framing/BasicCancelOk.cs | 78 + .../client/framing/BasicConsume.cs | 125 ++ .../client/framing/BasicConsumeOk.cs | 78 + .../client/framing/BasicDeliver.cs | 105 ++ .../client/framing/BasicGet.cs | 91 + .../client/framing/BasicGetEmpty.cs | 78 + .../client/framing/BasicGetOk.cs | 104 ++ .../client/framing/BasicMethodConstants.cs | 55 + .../client/framing/BasicNack.cs | 90 + .../client/framing/BasicProperties.cs | 306 ++++ .../client/framing/BasicPublish.cs | 104 ++ .../client/framing/BasicQos.cs | 90 + .../client/framing/BasicQosOk.cs} | 61 +- .../client/framing/BasicRecover.cs | 78 + .../client/framing/BasicRecoverAsync.cs | 78 + .../client/framing/BasicRecoverOk.cs | 70 + .../client/framing/BasicReject.cs | 84 + .../client/framing/BasicReturn.cs | 98 ++ .../client/framing/ChannelClose.cs | 96 ++ .../client/framing/ChannelCloseOk.cs | 70 + .../client/framing/ChannelFlow.cs | 78 + .../client/framing/ChannelFlowOk.cs | 78 + .../client/framing/ChannelMethodConstants.cs} | 28 +- .../client/framing/ChannelOpen.cs | 78 + .../client/framing/ChannelOpenOk.cs | 78 + .../client/framing/ClassConstants.cs | 44 + .../RabbitMQ.Client/client/framing/ClassId.cs | 45 + .../client/framing/ConfirmMethodConstants.cs | 39 + .../client/framing/ConfirmSelect.cs | 78 + .../client/framing/ConfirmSelectOk.cs | 70 + .../client/framing/ConnectionBlocked.cs | 78 + .../client/framing/ConnectionClose.cs | 96 ++ .../client/framing/ConnectionCloseOk.cs | 70 + .../framing/ConnectionMethodConstants.cs | 51 + .../client/framing/ConnectionOpen.cs | 92 ++ .../client/framing/ConnectionOpenOk.cs | 78 + .../client/framing/ConnectionSecure.cs | 78 + .../client/framing/ConnectionSecureOk.cs | 78 + .../client/framing/ConnectionStart.cs | 106 ++ .../client/framing/ConnectionStartOk.cs | 101 ++ .../client/framing/ConnectionTune.cs | 89 + .../client/framing/ConnectionTuneOk.cs | 89 + .../client/framing/ConnectionUnblocked.cs | 70 + .../client/framing/ConnectionUpdateSecret.cs | 85 + .../framing/ConnectionUpdateSecretOk.cs | 70 + .../client/framing/Constants.cs | 85 + .../client/framing/ExchangeBind.cs | 114 ++ .../client/framing/ExchangeBindOk.cs | 70 + .../client/framing/ExchangeDeclare.cs | 131 ++ .../client/framing/ExchangeDeclareOk.cs | 70 + .../client/framing/ExchangeDelete.cs | 97 ++ .../client/framing/ExchangeDeleteOk.cs | 70 + .../client/framing/ExchangeMethodConstants.cs | 45 + .../client/framing/ExchangeUnbind.cs | 114 ++ .../client/framing/ExchangeUnbindOk.cs | 70 + .../RabbitMQ.Client/client/framing/Model.cs | 599 +++++++ .../client/framing/Protocol.cs | 151 ++ .../client/framing/QueueBind.cs | 114 ++ .../client/framing/QueueBindOk.cs | 70 + .../client/framing/QueueDeclare.cs | 124 ++ .../client/framing/QueueDeclareOk.cs | 90 + .../client/framing/QueueDelete.cs | 103 ++ .../client/framing/QueueDeleteOk.cs | 77 + .../client/framing/QueueMethodConstants.cs | 47 + .../client/framing/QueuePurge.cs | 91 + .../client/framing/QueuePurgeOk.cs | 77 + .../client/framing/QueueUnbind.cs | 107 ++ .../client/framing/QueueUnbindOk.cs | 70 + .../client/framing/TxCommit.cs} | 54 +- .../client/framing/TxCommitOk.cs | 70 + .../client/framing/TxMethodConstants.cs | 43 + .../client/framing/TxRollback.cs | 70 + .../client/framing/TxRollbackOk.cs | 70 + .../client/framing/TxSelect.cs | 70 + .../client/framing/TxSelectOk.cs | 70 + 83 files changed, 6905 insertions(+), 1646 deletions(-) delete mode 100755 projects/Apigen/Apigen.csproj delete mode 100644 projects/Apigen/apigen/AmqpEntity.cs delete mode 100644 projects/Apigen/apigen/Apigen.cs create mode 100644 projects/RabbitMQ.Client/client/framing/BasicAck.cs create mode 100644 projects/RabbitMQ.Client/client/framing/BasicCancel.cs create mode 100644 projects/RabbitMQ.Client/client/framing/BasicCancelOk.cs create mode 100644 projects/RabbitMQ.Client/client/framing/BasicConsume.cs create mode 100644 projects/RabbitMQ.Client/client/framing/BasicConsumeOk.cs create mode 100644 projects/RabbitMQ.Client/client/framing/BasicDeliver.cs create mode 100644 projects/RabbitMQ.Client/client/framing/BasicGet.cs create mode 100644 projects/RabbitMQ.Client/client/framing/BasicGetEmpty.cs create mode 100644 projects/RabbitMQ.Client/client/framing/BasicGetOk.cs create mode 100644 projects/RabbitMQ.Client/client/framing/BasicMethodConstants.cs create mode 100644 projects/RabbitMQ.Client/client/framing/BasicNack.cs create mode 100644 projects/RabbitMQ.Client/client/framing/BasicProperties.cs create mode 100644 projects/RabbitMQ.Client/client/framing/BasicPublish.cs create mode 100644 projects/RabbitMQ.Client/client/framing/BasicQos.cs rename projects/{Apigen/apigen/AmqpClass.cs => RabbitMQ.Client/client/framing/BasicQosOk.cs} (55%) create mode 100644 projects/RabbitMQ.Client/client/framing/BasicRecover.cs create mode 100644 projects/RabbitMQ.Client/client/framing/BasicRecoverAsync.cs create mode 100644 projects/RabbitMQ.Client/client/framing/BasicRecoverOk.cs create mode 100644 projects/RabbitMQ.Client/client/framing/BasicReject.cs create mode 100644 projects/RabbitMQ.Client/client/framing/BasicReturn.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ChannelClose.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ChannelCloseOk.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ChannelFlow.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ChannelFlowOk.cs rename projects/{Apigen/apigen/AmqpField.cs => RabbitMQ.Client/client/framing/ChannelMethodConstants.cs} (72%) create mode 100644 projects/RabbitMQ.Client/client/framing/ChannelOpen.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ChannelOpenOk.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ClassConstants.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ClassId.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ConfirmMethodConstants.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ConfirmSelect.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ConfirmSelectOk.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ConnectionBlocked.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ConnectionClose.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ConnectionCloseOk.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ConnectionMethodConstants.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ConnectionOpen.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ConnectionOpenOk.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ConnectionSecure.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ConnectionSecureOk.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ConnectionStart.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ConnectionStartOk.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ConnectionTune.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ConnectionTuneOk.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ConnectionUnblocked.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ConnectionUpdateSecret.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ConnectionUpdateSecretOk.cs create mode 100644 projects/RabbitMQ.Client/client/framing/Constants.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ExchangeBind.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ExchangeBindOk.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ExchangeDeclare.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ExchangeDeclareOk.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ExchangeDelete.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ExchangeDeleteOk.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ExchangeMethodConstants.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ExchangeUnbind.cs create mode 100644 projects/RabbitMQ.Client/client/framing/ExchangeUnbindOk.cs create mode 100644 projects/RabbitMQ.Client/client/framing/Model.cs create mode 100644 projects/RabbitMQ.Client/client/framing/Protocol.cs create mode 100644 projects/RabbitMQ.Client/client/framing/QueueBind.cs create mode 100644 projects/RabbitMQ.Client/client/framing/QueueBindOk.cs create mode 100644 projects/RabbitMQ.Client/client/framing/QueueDeclare.cs create mode 100644 projects/RabbitMQ.Client/client/framing/QueueDeclareOk.cs create mode 100644 projects/RabbitMQ.Client/client/framing/QueueDelete.cs create mode 100644 projects/RabbitMQ.Client/client/framing/QueueDeleteOk.cs create mode 100644 projects/RabbitMQ.Client/client/framing/QueueMethodConstants.cs create mode 100644 projects/RabbitMQ.Client/client/framing/QueuePurge.cs create mode 100644 projects/RabbitMQ.Client/client/framing/QueuePurgeOk.cs create mode 100644 projects/RabbitMQ.Client/client/framing/QueueUnbind.cs create mode 100644 projects/RabbitMQ.Client/client/framing/QueueUnbindOk.cs rename projects/{Apigen/apigen/AmqpMethod.cs => RabbitMQ.Client/client/framing/TxCommit.cs} (59%) create mode 100644 projects/RabbitMQ.Client/client/framing/TxCommitOk.cs create mode 100644 projects/RabbitMQ.Client/client/framing/TxMethodConstants.cs create mode 100644 projects/RabbitMQ.Client/client/framing/TxRollback.cs create mode 100644 projects/RabbitMQ.Client/client/framing/TxRollbackOk.cs create mode 100644 projects/RabbitMQ.Client/client/framing/TxSelect.cs create mode 100644 projects/RabbitMQ.Client/client/framing/TxSelectOk.cs diff --git a/RabbitMQDotNetClient.sln b/RabbitMQDotNetClient.sln index 8c7cd7253c..e7b966dc5e 100644 --- a/RabbitMQDotNetClient.sln +++ b/RabbitMQDotNetClient.sln @@ -12,8 +12,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RabbitMQ.Client", "projects EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Unit", "projects\Unit\Unit.csproj", "{B8FAC024-CC03-4067-9FFC-02846FB8AE48}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Apigen", "projects\Apigen\Apigen.csproj", "{B416DDB7-5E3E-4A20-B5A9-C6E518E203A2}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -28,10 +26,6 @@ Global {B8FAC024-CC03-4067-9FFC-02846FB8AE48}.Debug|Any CPU.Build.0 = Debug|Any CPU {B8FAC024-CC03-4067-9FFC-02846FB8AE48}.Release|Any CPU.ActiveCfg = Release|Any CPU {B8FAC024-CC03-4067-9FFC-02846FB8AE48}.Release|Any CPU.Build.0 = Release|Any CPU - {B416DDB7-5E3E-4A20-B5A9-C6E518E203A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B416DDB7-5E3E-4A20-B5A9-C6E518E203A2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B416DDB7-5E3E-4A20-B5A9-C6E518E203A2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B416DDB7-5E3E-4A20-B5A9-C6E518E203A2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/build.bat b/build.bat index c93c305127..add2a96ff9 100644 --- a/build.bat +++ b/build.bat @@ -1,5 +1,4 @@ @ECHO OFF set DOTNET_CLI_TELEMETRY_OPTOUT=1 dotnet restore .\RabbitMQDotNetClient.sln -dotnet run -p .\projects\Apigen\Apigen.csproj --apiName:AMQP_0_9_1 .\projects\specs\amqp0-9-1.stripped.xml .\gensrc\autogenerated-api-0-9-1.cs dotnet build .\RabbitMQDotNetClient.sln diff --git a/projects/Apigen/Apigen.csproj b/projects/Apigen/Apigen.csproj deleted file mode 100755 index 29c726c6f5..0000000000 --- a/projects/Apigen/Apigen.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - netcoreapp3.1 - Exe - - - - - - - diff --git a/projects/Apigen/apigen/AmqpEntity.cs b/projects/Apigen/apigen/AmqpEntity.cs deleted file mode 100644 index 07b62ce45a..0000000000 --- a/projects/Apigen/apigen/AmqpEntity.cs +++ /dev/null @@ -1,83 +0,0 @@ -// This source code is dual-licensed under the Apache License, version -// 2.0, and the Mozilla Public License, version 2.0. -// -// The APL v2.0: -// -//--------------------------------------------------------------------------- -// Copyright (c) 2007-2020 VMware, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -//--------------------------------------------------------------------------- -// -// The MPL v2.0: -// -//--------------------------------------------------------------------------- -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at https://mozilla.org/MPL/2.0/. -// -// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. -//--------------------------------------------------------------------------- - -using System.Xml; - -namespace RabbitMQ.Client.Apigen -{ - public class AmqpEntity { - public XmlNode m_node; - - public AmqpEntity(XmlNode n) { - m_node = n; - } - - public string GetString(string path) { - return Apigen.GetString(m_node, path); - } - - public string GetString(string path, string d) { - return Apigen.GetString(m_node, path, d); - } - - public int GetInt(string path) { - return Apigen.GetInt(m_node, path); - } - - public string Name { - get { - return GetString("@name"); - } - } - - public string DocumentationComment(string prefixSpaces) { - return DocumentationComment(prefixSpaces, "doc"); - } - - public string DocumentationCommentVariant(string prefixSpaces, string tagname) { - return DocumentationComment(prefixSpaces, "doc", tagname); - } - - public string DocumentationComment(string prefixSpaces, string docXpath) { - return DocumentationComment(prefixSpaces, docXpath, "summary"); - } - - public string DocumentationComment(string prefixSpaces, string docXpath, string tagname) { - string docStr = GetString(docXpath, "").Trim(); - if (docStr.Length > 0) { - return $"{prefixSpaces}/// <{tagname}>\n{GetString(docXpath, "")}\n" - .Replace("\n", $"\n{prefixSpaces}/// "); - } else { - return $"{prefixSpaces}// (no documentation)"; - } - } - } -} diff --git a/projects/Apigen/apigen/Apigen.cs b/projects/Apigen/apigen/Apigen.cs deleted file mode 100644 index 3ccfb5590a..0000000000 --- a/projects/Apigen/apigen/Apigen.cs +++ /dev/null @@ -1,1460 +0,0 @@ -// This source code is dual-licensed under the Apache License, version -// 2.0, and the Mozilla Public License, version 2.0. -// -// The APL v2.0: -// -//--------------------------------------------------------------------------- -// Copyright (c) 2007-2020 VMware, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -//--------------------------------------------------------------------------- -// -// The MPL v2.0: -// -//--------------------------------------------------------------------------- -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at https://mozilla.org/MPL/2.0/. -// -// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. -//--------------------------------------------------------------------------- - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Xml; - -using RabbitMQ.Client.Apigen.Attributes; - -namespace RabbitMQ.Client.Apigen -{ - public static class ApigenExtensions - { - public static T Attribute(this MemberInfo mi) where T : Attribute - { - return mi.GetCustomAttribute(false); - } - - public static T Attribute(this ParameterInfo pi) where T : Attribute - { - return pi.GetCustomAttribute(false); - } - - public static T Attribute(this ICustomAttributeProvider p) where T : Attribute - { - return p.GetCustomAttributes(typeof(T), false).Cast().SingleOrDefault(); - } - } - - public class Apigen - { - /////////////////////////////////////////////////////////////////////////// - // Entry point - - public static void Main(string[] args) - { - Apigen instance = new Apigen(new List(args)); - instance.Generate(); - } - - /////////////////////////////////////////////////////////////////////////// - // XML utilities - - public static XmlNodeList GetNodes(XmlNode n0, string path) - { - return n0.SelectNodes(path); - } - - public static string GetString(XmlNode n0, string path, string d) - { - XmlNode n = n0.SelectSingleNode(path); - string pathOrDefault = (n == null) ? d : n.InnerText; - return xmlStringMapper(pathOrDefault); - } - - public static string GetString(XmlNode n0, string path) - { - string s = GetString(n0, path, null); - if (s == null) - { - throw new Exception($"Missing spec XML node: {path}"); - } - return s; - } - - public static int GetInt(XmlNode n0, string path, int d) - { - string s = GetString(n0, path, null); - return (s == null) ? d : int.Parse(s); - } - - public static int GetInt(XmlNode n0, string path) - { - return int.Parse(GetString(n0, path)); - } - - /// - /// Rename all instances of an entire string from the XML spec - /// - /// input string from XML spec - /// renamed string - private static string xmlStringMapper(string xmlString) - { - switch (xmlString) - { - case "no-wait": - return "nowait"; - default: - return xmlString; - } - } - - /////////////////////////////////////////////////////////////////////////// - // Name manipulation and mangling for C# - - public static string MangleConstant(string name) - { - // Previously, we used C_STYLE_CONSTANT_NAMES: - /* - return name - .Replace(" ", "_") - .Replace("-", "_"). - ToUpper(); - */ - // ... but TheseKindsOfNames are more in line with .NET style guidelines. - return MangleClass(name); - } - - public static IList IdentifierParts(string name) - { - IList result = new List(); - foreach (string s1 in name.Split(new char[] { '-', ' ' })) - { - result.Add(s1); - } - return result; - } - - public static string MangleClass(string name) - { - StringBuilder sb = new StringBuilder(); - foreach (string s in IdentifierParts(name)) - { - sb.Append(char.ToUpperInvariant(s[0]) + s.Substring(1).ToLowerInvariant()); - } - return sb.ToString(); - } - - public static string MangleMethod(string name) - { - StringBuilder sb = new StringBuilder(); - bool useUpper = false; - foreach (string s in IdentifierParts(name)) - { - if (useUpper) - { - sb.Append(char.ToUpperInvariant(s[0]) + s.Substring(1).ToLowerInvariant()); - } - else - { - sb.Append(s.ToLowerInvariant()); - useUpper = true; - } - } - return sb.ToString(); - } - - public static string MangleMethodClass(AmqpClass c, AmqpMethod m) - { - return MangleClass(c.Name) + MangleClass(m.Name); - } - - /////////////////////////////////////////////////////////////////////////// - - public string m_inputXmlFilename; - public string m_outputFilename; - - public XmlDocument m_spec = null; - public TextWriter m_outputFile = null; - - public int m_majorVersion; - public int m_minorVersion; - public int m_revision = 0; - public string m_apiName; - public bool m_emitComments = false; - - public Type m_modelType = typeof(RabbitMQ.Client.Impl.IFullModel); - public IList m_modelTypes = new List(); - public IList> m_constants = new List>(); - public IList m_classes = new List(); - public IDictionary m_domains = new Dictionary(); - - public static IDictionary m_primitiveTypeMap; - public static IDictionary m_primitiveTypeFlagMap; - - static Apigen() - { - m_primitiveTypeMap = new Dictionary(); - m_primitiveTypeFlagMap = new Dictionary(); - InitPrimitiveType("octet", "byte", false); - InitPrimitiveType("shortstr", "string", true); - InitPrimitiveType("longstr", "byte[]", true); - InitPrimitiveType("short", "ushort", false); - InitPrimitiveType("long", "uint", false); - InitPrimitiveType("longlong", "ulong", false); - InitPrimitiveType("bit", "bool", false); - InitPrimitiveType("table", "IDictionary", true); - InitPrimitiveType("timestamp", "AmqpTimestamp", false); - InitPrimitiveType("content", "byte[]", true); - } - - public static void InitPrimitiveType(string amqpType, string dotnetType, bool isReference) - { - m_primitiveTypeMap[amqpType] = dotnetType; - m_primitiveTypeFlagMap[amqpType] = isReference; - } - - public void HandleOption(string opt) - { - if (opt.StartsWith("--apiName:")) - { - m_apiName = opt.Substring(9); - } - else if (opt == "-c") - { - m_emitComments = true; - } - else - { - Console.Error.WriteLine($"Unsupported command-line option: {opt}"); - Usage(); - } - } - - public void Usage() - { - Console.Error.WriteLine("Usage: Apigen.exe [options ...] "); - Console.Error.WriteLine(" Options include:"); - Console.Error.WriteLine(" --apiName:"); - Console.Error.WriteLine(" The apiName option is required."); - Environment.Exit(1); - } - - public Apigen(IList args) - { - while (args.Count > 0 && args[0].StartsWith("--")) - { - HandleOption(args[0]); - args.RemoveAt(0); - } - if ((args.Count < 2) - || (m_apiName == null)) - { - Usage(); - } - m_inputXmlFilename = args[0]; - m_outputFilename = args[1]; - } - - /////////////////////////////////////////////////////////////////////////// - - public static string ApiNamespaceBase => "RabbitMQ.Client.Framing"; - - public static string ImplNamespaceBase => "RabbitMQ.Client.Framing.Impl"; - - public void Generate() - { - LoadSpec(); - ParseSpec(); - ReflectModel(); - GenerateOutput(); - } - - public void LoadSpec() - { - Console.WriteLine($"* Loading spec from '{m_inputXmlFilename}'"); - m_spec = new XmlDocument(); - - using (var stream = new FileStream(m_inputXmlFilename, FileMode.Open, FileAccess.Read)) - { - m_spec.Load(stream); - } - } - - public void ParseSpec() - { - m_majorVersion = GetInt(m_spec, "/amqp/@major"); - m_minorVersion = GetInt(m_spec, "/amqp/@minor"); - m_revision = GetInt(m_spec, "/amqp/@revision"); - - Console.WriteLine("* Parsing spec for version {0}.{1}.{2}", m_majorVersion, m_minorVersion, m_revision); - foreach (XmlNode n in m_spec.SelectNodes("/amqp/constant")) - { - m_constants.Add(new KeyValuePair(GetString(n, "@name"), GetInt(n, "@value"))); - } - foreach (XmlNode n in m_spec.SelectNodes("/amqp/class")) - { - m_classes.Add(new AmqpClass(n)); - } - foreach (XmlNode n in m_spec.SelectNodes("/amqp/domain")) - { - m_domains[GetString(n, "@name")] = GetString(n, "@type"); - } - } - - public void ReflectModel() - { - m_modelTypes.Add(m_modelType); - for (int i = 0; i < m_modelTypes.Count; i++) - { - foreach (Type intf in m_modelTypes[i].GetInterfaces()) - { - m_modelTypes.Add(intf); - } - } - } - - public string ResolveDomain(string d) - { - while (m_domains.ContainsKey(d)) - { - string newD = m_domains[d]; - if (d.Equals(newD)) - { - break; - } - - d = newD; - } - return d; - } - - public string MapDomain(string d) - { - return m_primitiveTypeMap[ResolveDomain(d)]; - } - - public string VersionToken() - { - return $"v{m_majorVersion}_{m_minorVersion}"; - } - - public void GenerateOutput() - { - Console.WriteLine($"* Generating code into '{m_outputFilename}'"); - - string directory = Path.GetDirectoryName(m_outputFilename); - - if (!Directory.Exists(directory)) - { - Directory.CreateDirectory(directory); - } - - using (var stream = new FileStream(m_outputFilename, FileMode.Create, FileAccess.Write)) - { - m_outputFile = new StreamWriter(stream); - EmitPrelude(); - EmitPublic(); - EmitPrivate(); - m_outputFile.Dispose(); - } - } - - public void Emit(object o) - { - m_outputFile.Write(o); - } - - public void EmitLine(object o) - { - m_outputFile.WriteLine(o); - } - - public void EmitSpecComment(object o) - { - if (m_emitComments) - { - EmitLine(o); - } - } - - public void EmitPrelude() - { - const string prelude = -@"// Autogenerated code. Do not edit. - -// This source code is dual-licensed under the Apache License, version -// 2.0, and the Mozilla Public License, version 2.0. -// -// The APL v2.0: -// -//--------------------------------------------------------------------------- -// Copyright (c) 2007-2020 VMware, Inc. -// -// Licensed under the Apache License, Version 2.0 (the ""License""); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ""AS IS"" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -//--------------------------------------------------------------------------- -// -// The MPL v2.0: -// -//--------------------------------------------------------------------------- -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at https://mozilla.org/MPL/2.0/. -// -// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. -//--------------------------------------------------------------------------- - -using System; -using System.Collections.Generic; -using System.Text; - -using RabbitMQ.Client; -using RabbitMQ.Client.Exceptions; -using RabbitMQ.Client.Framing.Impl; -using RabbitMQ.Client.Impl; -"; - EmitLine(prelude); - } - - public void EmitPublic() - { - int port = GetInt(m_spec, "/amqp/@port"); - string publicVars = -$@"namespace {ApiNamespaceBase} -{{ - internal sealed class Protocol : {ImplNamespaceBase}.ProtocolBase - {{ - ///Protocol major version (= {m_majorVersion}) - public override int MajorVersion => {m_majorVersion}; - - ///Protocol minor version (= {m_minorVersion}) - public override int MinorVersion => {m_minorVersion}; - - ///Protocol revision (= {m_revision}) - public override int Revision => {m_revision}; - - ///Protocol API name (= {m_apiName}) - public override string ApiName => ""{m_apiName}""; - - ///Default TCP port (= {port}) - public override int DefaultPort => {port}; -"; - - EmitLine("namespace RabbitMQ.Client"); - EmitLine("{"); - EmitLine(" public static class Constants"); - EmitLine(" {"); - foreach (KeyValuePair de in m_constants) - { - EmitLine($" ///(= {de.Value})"); - EmitLine($" public const int {MangleConstant(de.Key)} = {de.Value};"); - } - EmitLine(" }"); - EmitLine("}"); - EmitLine(publicVars); - EmitMethodArgumentReader(); - EmitLine(""); - EmitContentHeaderReader(); - EmitLine(" }"); - foreach (AmqpClass c in m_classes) - { - EmitClassMethods(c); - } - foreach (AmqpClass c in m_classes) - { - if (c.NeedsProperties) - { - EmitClassProperties(c); - } - } - EmitLine("}"); - } - - public void EmitAutogeneratedSummary(string prefixSpaces, string extra) - { - EmitLine($"{prefixSpaces}/// Autogenerated type. {extra}"); - } - - public void EmitClassMethods(AmqpClass c) - { - foreach (AmqpMethod m in c.m_Methods) - { - EmitAutogeneratedSummary(" ", $"AMQP specification method \"{c.Name}.{m.Name}\"."); - EmitSpecComment(m.DocumentationCommentVariant(" ", "remarks")); - EmitLine($" internal interface I{MangleMethodClass(c, m)} : IMethod"); - EmitLine(" {"); - foreach (AmqpField f in m.m_Fields) - { - EmitSpecComment(f.DocumentationComment(" ")); - EmitLine($" {MapDomain(f.Domain)} {MangleClass(f.Name)} {{ get; }}"); - } - EmitLine(" }"); - } - } - - public bool HasFactoryMethod(AmqpClass c) - { - foreach (Type t in m_modelTypes) - { - foreach (MethodInfo method in t.GetMethods()) - { - AmqpContentHeaderFactoryAttribute f = method.Attribute(); - if (f != null && MangleClass(f.m_contentClass) == MangleClass(c.Name)) - { - return true; - } - } - } - return false; - } - - public bool IsBoolean(AmqpField f) - { - return ResolveDomain(f.Domain) == "bit"; - } - - public bool IsReferenceType(AmqpField f) - { - return m_primitiveTypeFlagMap[ResolveDomain(f.Domain)]; - } - - public bool IsAmqpClass(Type t) - { - foreach (AmqpClass c in m_classes) - { - if (c.Name == t.Name) - { - return true; - } - } - return false; - } - - public void EmitClassProperties(AmqpClass c) - { - bool hasCommonApi = HasFactoryMethod(c); - string propertiesBaseClass = $"RabbitMQ.Client.Impl.{(hasCommonApi ? $"{MangleClass(c.Name)}Properties" : "ContentHeaderBase")}"; - string maybeOverride = hasCommonApi ? "override " : ""; - - EmitAutogeneratedSummary(" ", $"AMQP specification content header properties for content class \"{c.Name}\""); - EmitSpecComment(c.DocumentationCommentVariant(" ", "remarks")); - EmitLine($" internal sealed class {MangleClass(c.Name)}Properties : {propertiesBaseClass}"); - EmitLine(" {"); - foreach (AmqpField f in c.m_Fields) - { - EmitLine($" private {MapDomain(f.Domain)} _{MangleMethod(f.Name)};"); - } - EmitLine(""); - foreach (AmqpField f in c.m_Fields) - { - EmitSpecComment(f.DocumentationComment(" ", "@label")); - EmitLine($" public {maybeOverride}{MapDomain(f.Domain)} {MangleClass(f.Name)}"); - EmitLine(" {"); - EmitLine($" get => _{MangleMethod(f.Name)};"); - EmitLine($" set => _{MangleMethod(f.Name)} = value;"); - EmitLine(" }"); - EmitLine(""); - } - foreach (AmqpField f in c.m_Fields) - { - if (!IsBoolean(f)) - { - EmitLine($" public {maybeOverride}void Clear{MangleClass(f.Name)}() => _{MangleMethod(f.Name)} = default;"); - EmitLine(""); - } - } - - foreach (AmqpField f in c.m_Fields) - { - if (!IsBoolean(f)) - { - EmitLine($" public {maybeOverride}bool Is{MangleClass(f.Name)}Present() => _{MangleMethod(f.Name)} != default;"); - EmitLine(""); - } - } - - EmitLine($" public {MangleClass(c.Name)}Properties() {{ }}"); - EmitLine($" public override ushort ProtocolClassId => {c.Index};"); - EmitLine($" public override string ProtocolClassName => \"{c.Name}\";"); - EmitLine(""); - EmitLine(" internal override void ReadPropertiesFrom(ref Client.Impl.ContentHeaderPropertyReader reader)"); - EmitLine(" {"); - foreach (AmqpField f in c.m_Fields) - { - if (IsBoolean(f)) - { - EmitLine($" var {MangleMethod(f.Name)} = reader.ReadBit();"); - } - else - { - EmitLine($" var {MangleMethod(f.Name)}_present = reader.ReadPresence();"); - } - } - EmitLine(" reader.FinishPresence();"); - foreach (AmqpField f in c.m_Fields) - { - if (!IsBoolean(f)) - { - EmitLine($" if ({MangleMethod(f.Name)}_present) {{ _{MangleMethod(f.Name)} = reader.Read{MangleClass(ResolveDomain(f.Domain))}(); }}"); - } - } - EmitLine(" }"); - EmitLine(""); - EmitLine(" internal override void WritePropertiesTo(ref Client.Impl.ContentHeaderPropertyWriter writer)"); - EmitLine(" {"); - foreach (AmqpField f in c.m_Fields) - { - if (IsBoolean(f)) - { - EmitLine($" writer.WriteBit(_{MangleMethod(f.Name)});"); - } - else - { - EmitLine($" writer.WritePresence(Is{MangleClass(f.Name)}Present());"); - } - } - EmitLine(" writer.FinishPresence();"); - foreach (AmqpField f in c.m_Fields) - { - if (!IsBoolean(f)) - { - EmitLine($" if (Is{MangleClass(f.Name)}Present()) {{ writer.Write{MangleClass(ResolveDomain(f.Domain))}(_{MangleMethod(f.Name)}); }}"); - } - } - EmitLine(" }"); - EmitLine(""); - EmitLine(" public override int GetRequiredPayloadBufferSize()"); - EmitLine(" {"); - EmitLine($" int bufferSize = {Math.Max((int)Math.Ceiling(c.m_Fields.Count / 15.0), 1) * 2}; // number of presence fields ({c.m_Fields.Count}) in 2 bytes blocks"); - foreach (AmqpField f in c.m_Fields) - { - switch (MapDomain(f.Domain)) - { - case "byte": - EmitLine($" if (Is{MangleClass(f.Name)}Present()) {{ bufferSize++; }} // _{MangleMethod(f.Name)} in bytes"); - break; - case "string": - EmitLine($" if (Is{MangleClass(f.Name)}Present()) {{ bufferSize += 1 + Encoding.UTF8.GetByteCount(_{MangleMethod(f.Name)}); }} // _{MangleMethod(f.Name)} in bytes"); - break; - case "byte[]": - EmitLine($" if (Is{MangleClass(f.Name)}Present()) {{ bufferSize += 4 + _{MangleMethod(f.Name)}.Length; }} // _{MangleMethod(f.Name)} in bytes"); - break; - case "ushort": - EmitLine($" if (Is{MangleClass(f.Name)}Present()) {{ bufferSize += 2; }} // _{MangleMethod(f.Name)} in bytes"); - break; - case "uint": - EmitLine($" if (Is{MangleClass(f.Name)}Present()) {{ bufferSize += 4; }} // _{MangleMethod(f.Name)} in bytes"); - break; - case "ulong": - case "AmqpTimestamp": - EmitLine($" if (Is{MangleClass(f.Name)}Present()) {{ bufferSize += 8; }} // _{MangleMethod(f.Name)} in bytes"); - break; - case "bool": - // TODO: implement if used, not used anywhere yet - break; - case "IDictionary": - EmitLine($" if (Is{MangleClass(f.Name)}Present()) {{ bufferSize += WireFormatting.GetTableByteCount(_{MangleMethod(f.Name)}); }} // _{MangleMethod(f.Name)} in bytes"); - break; - default: - throw new ArgumentOutOfRangeException($"Can't handle size calculations for type = {f.Domain};"); - } - } - - EmitLine(" return bufferSize;"); - EmitLine(" }"); - EmitLine(""); - EmitLine(" public override void AppendPropertyDebugStringTo(StringBuilder sb)"); - EmitLine(" {"); - EmitLine(" sb.Append(\"(\");"); - { - int remaining = c.m_Fields.Count; - foreach (AmqpField f in c.m_Fields) - { - Emit($" sb.Append(\"{f.Name}=\")"); - if (IsBoolean(f)) - { - Emit($".Append(_{MangleMethod(f.Name)})"); - } - else - { - Emit($".Append(Is{MangleClass(f.Name)}Present() ? _{MangleMethod(f.Name)}.ToString() : \"_\")"); - } - remaining--; - if (remaining > 0) - { - EmitLine(".Append(\", \");"); - } - else - { - EmitLine(";"); - } - } - } - EmitLine(" sb.Append(\")\");"); - EmitLine(" }"); - EmitLine(" }"); - } - - public void EmitPrivate() - { - EmitLine($"namespace {ImplNamespaceBase}"); - EmitLine("{"); - EmitLine(" internal static class ClassConstants"); - EmitLine(" {"); - foreach (AmqpClass c in m_classes) - { - EmitLine($" internal const ushort {MangleConstant(c.Name)} = {c.Index};"); - } - EmitLine(" }"); - EmitLine(""); - EmitLine(" internal enum ClassId"); - EmitLine(" {"); - foreach (AmqpClass c in m_classes) - { - EmitLine($" {MangleConstant(c.Name)} = {c.Index},"); - } - EmitLine(" Invalid = -1,"); - EmitLine(" }"); - EmitLine(""); - foreach (AmqpClass c in m_classes) - { - EmitLine($" internal static class {MangleClass(c.Name)}MethodConstants"); - EmitLine(" {"); - foreach (AmqpMethod m in c.m_Methods) - { - EmitLine($" internal const ushort {MangleConstant(m.Name)} = {m.Index};"); - } - EmitLine(" }"); - } - EmitLine(""); - foreach (AmqpClass c in m_classes) - { - EmitClassMethodImplementations(c); - } - EmitLine(""); - EmitModelImplementation(); - EmitLine("}"); - } - - public void EmitClassMethodImplementations(AmqpClass c) - { - foreach (AmqpMethod m in c.m_Methods) - { - EmitAutogeneratedSummary(" ", "Private implementation class - do not use directly."); - EmitLine($" internal sealed class {MangleMethodClass(c, m)} : Client.Impl.MethodBase, I{MangleMethodClass(c, m)}"); - EmitLine(" {"); - foreach (AmqpField f in m.m_Fields) - { - EmitLine($" public {MapDomain(f.Domain)} _{MangleMethod(f.Name)};"); - } - EmitLine(""); - foreach (AmqpField f in m.m_Fields) - { - EmitLine($" {MapDomain(f.Domain)} I{MangleMethodClass(c, m)}.{MangleClass(f.Name)} => _{MangleMethod(f.Name)};"); - } - EmitLine(""); - if (m.m_Fields.Count > 0) - { - EmitLine($" public {MangleMethodClass(c, m)}() {{}}"); - } - EmitLine($" public {MangleMethodClass(c, m)}({string.Join(", ", m.m_Fields.Select(f => $"{MapDomain(f.Domain)} @{MangleClass(f.Name)}"))})"); - EmitLine(" {"); - foreach (AmqpField f in m.m_Fields) - { - EmitLine($" _{MangleMethod(f.Name)} = @{MangleClass(f.Name)};"); - } - EmitLine(" }"); - EmitLine(""); - EmitLine($" public override ushort ProtocolClassId => ClassConstants.{MangleConstant(c.Name)};"); - EmitLine($" public override ushort ProtocolMethodId => {MangleConstant(c.Name)}MethodConstants.{MangleConstant(m.Name)};"); - EmitLine($" public override string ProtocolMethodName => \"{c.Name}.{m.Name}\";"); - EmitLine($" public override bool HasContent => {(m.HasContent ? "true" : "false")};"); - EmitLine(""); - EmitLine(" public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader)"); - EmitLine(" {"); - foreach (AmqpField f in m.m_Fields) - { - EmitLine($" _{MangleMethod(f.Name)} = reader.Read{MangleClass(ResolveDomain(f.Domain))}();"); - } - EmitLine(" }"); - EmitLine(""); - EmitLine(" public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer)"); - EmitLine(" {"); - var lastWasBitClass = false; - foreach (AmqpField f in m.m_Fields) - { - string mangleClass = MangleClass(ResolveDomain(f.Domain)); - if (mangleClass != "Bit") - { - if (lastWasBitClass) - { - EmitLine($" writer.EndBits();"); - lastWasBitClass = false; - } - } - else - { - lastWasBitClass = true; - } - - EmitLine($" writer.Write{mangleClass}(_{MangleMethod(f.Name)});"); - } - if (lastWasBitClass) - { - EmitLine($" writer.EndBits();"); - } - EmitLine(" }"); - EmitLine(""); - EmitLine(" public override int GetRequiredBufferSize()"); - EmitLine(" {"); - - int bitCount = 0; - int bytesSize = 0; - var commentBuilder = new StringBuilder(" // bytes for "); - foreach (AmqpField f in m.m_Fields) - { - switch (MapDomain(f.Domain)) - { - case "byte": - bytesSize++; - commentBuilder.Append('_').Append(MangleMethod(f.Name)).Append(", "); - break; - case "string": - bytesSize++; - commentBuilder.Append("length of _").Append(MangleMethod(f.Name)).Append(", "); - break; - case "byte[]": - bytesSize += 4; - commentBuilder.Append("length of _").Append(MangleMethod(f.Name)).Append(", "); - break; - case "ushort": - bytesSize += 2; - commentBuilder.Append('_').Append(MangleMethod(f.Name)).Append(", "); - break; - case "uint": - bytesSize += 4; - commentBuilder.Append('_').Append(MangleMethod(f.Name)).Append(", "); - break; - case "ulong": - case "AmqpTimestamp": - bytesSize += 8; - commentBuilder.Append('_').Append(MangleMethod(f.Name)).Append(", "); - break; - case "bool": - if (bitCount == 0) - { - commentBuilder.Append("bit fields, "); - } - bitCount++; - break; - case "IDictionary": - break; - default: - throw new ArgumentOutOfRangeException($"Can't handle size calculations for type = {f.Domain};"); - } - } - - // 13 = " // bytes for " - if (commentBuilder.Length > 14) - { - // cut of last ", " - commentBuilder.Length -= 2; - } - else - { - commentBuilder.Clear(); - } - bytesSize += (int)Math.Ceiling(bitCount / 8.0); - EmitLine($" int bufferSize = {bytesSize};{commentBuilder}"); - foreach (AmqpField f in m.m_Fields) - { - switch (MapDomain(f.Domain)) - { - case "byte": - case "ushort": - case "uint": - case "ulong": - case "AmqpTimestamp": - case "bool": - // size already calculated - break; - case "string": - EmitLine($" bufferSize += Encoding.UTF8.GetByteCount(_{MangleMethod(f.Name)}); // _{MangleMethod(f.Name)} in bytes"); - break; - case "byte[]": - EmitLine($" bufferSize += _{MangleMethod(f.Name)}.Length; // _{MangleMethod(f.Name)} in bytes"); - break; - case "IDictionary": - EmitLine($" bufferSize += WireFormatting.GetTableByteCount(_{MangleMethod(f.Name)}); // _{MangleMethod(f.Name)} in bytes"); - break; - default: - throw new ArgumentOutOfRangeException($"Can't handle size calculations for type = {f.Domain};"); - } - } - - EmitLine(" return bufferSize;"); - EmitLine(" }"); - EmitLine(""); - EmitLine(" public override void AppendArgumentDebugStringTo(StringBuilder sb)"); - EmitLine(" {"); - EmitLine(" sb.Append('(');"); - { - int remaining = m.m_Fields.Count; - foreach (AmqpField f in m.m_Fields) - { - Emit($" sb.Append(_{MangleMethod(f.Name)})"); - remaining--; - if (remaining > 0) - { - EmitLine(".Append(',');"); - } - else - { - EmitLine(";"); - } - } - } - EmitLine(" sb.Append(')');"); - EmitLine(" }"); - EmitLine(" }"); - } - } - - public void EmitMethodArgumentReader() - { - EmitLine(" internal override Client.Impl.MethodBase DecodeMethodFrom(ReadOnlySpan span)"); - EmitLine(" {"); - EmitLine(" ushort classId = Util.NetworkOrderDeserializer.ReadUInt16(span);"); - EmitLine(" ushort methodId = Util.NetworkOrderDeserializer.ReadUInt16(span.Slice(2));"); - EmitLine(" Client.Impl.MethodBase result = DecodeMethodFrom(classId, methodId);"); - EmitLine(" if(result != null)"); - EmitLine(" {"); - EmitLine(" Client.Impl.MethodArgumentReader reader = new Client.Impl.MethodArgumentReader(span.Slice(4));"); - EmitLine(" result.ReadArgumentsFrom(ref reader);"); - EmitLine(" return result;"); - EmitLine(" }"); - EmitLine(""); - EmitLine(" throw new Client.Exceptions.UnknownClassOrMethodException(classId, methodId);"); - EmitLine(" }"); - EmitLine(""); - EmitLine(" internal Client.Impl.MethodBase DecodeMethodFrom(ushort classId, ushort methodId)"); - EmitLine(" {"); - EmitLine(" switch ((classId << 16) | methodId)"); - EmitLine(" {"); - foreach (AmqpClass c in m_classes) - { - foreach (AmqpMethod m in c.m_Methods) - { - EmitLine($" case (ClassConstants.{MangleConstant(c.Name)} << 16) | {MangleConstant(c.Name)}MethodConstants.{MangleConstant(m.Name)}: return new Impl.{MangleMethodClass(c, m)}();"); - } - } - EmitLine(" default: return null;"); - EmitLine(" }"); - EmitLine(" }"); - EmitLine(""); - } - - public void EmitContentHeaderReader() - { - EmitLine(" internal override Client.Impl.ContentHeaderBase DecodeContentHeaderFrom(ushort classId)"); - EmitLine(" {"); - EmitLine(" switch (classId)"); - EmitLine(" {"); - foreach (AmqpClass c in m_classes) - { - if (c.NeedsProperties) - { - EmitLine($" case {c.Index}: return new {MangleClass(c.Name)}Properties();"); - } - } - EmitLine(" default: throw new Client.Exceptions.UnknownClassOrMethodException(classId, 0);"); - EmitLine(" }"); - EmitLine(" }"); - } - - public Attribute Attribute(MemberInfo mi, Type t) - { - return Attribute(mi.GetCustomAttributes(t, false), t); - } - - public Attribute Attribute(ParameterInfo pi, Type t) - { - return Attribute(pi.GetCustomAttributes(t, false), t); - } - - public Attribute Attribute(ICustomAttributeProvider p, Type t) - { - return Attribute(p.GetCustomAttributes(t, false), t); - } - - public Attribute Attribute(IEnumerable attributes, Type t) - { - TypeInfo typeInfo = t.GetTypeInfo(); - - if (typeInfo.IsSubclassOf(typeof(AmqpApigenAttribute))) - { - AmqpApigenAttribute result = null; - foreach (AmqpApigenAttribute candidate in attributes) - { - if (candidate.m_namespaceName == null && result == null) - { - result = candidate; - } - if (candidate.m_namespaceName == ApiNamespaceBase) - { - result = candidate; - } - } - return result; - } - else - { - foreach (Attribute attribute in attributes) - { - return attribute; - } - return null; - } - } - - public void EmitModelImplementation() - { - EmitLine(" internal class Model: Client.Impl.ModelBase {"); - EmitLine(" public Model(Client.Impl.ISession session): base(session) {}"); - EmitLine(" public Model(Client.Impl.ISession session, ConsumerWorkService workService): base(session, workService) {}"); - IList asynchronousHandlers = new List(); - foreach (Type t in m_modelTypes) - { - foreach (MethodInfo method in t.GetMethods()) - { - if (method.DeclaringType.Namespace != null && - method.DeclaringType.Namespace.StartsWith("RabbitMQ.Client")) - { - if (method.Name.StartsWith("Handle") || - (Attribute(method, typeof(AmqpAsynchronousHandlerAttribute)) != null)) - { - if ((Attribute(method, typeof(AmqpMethodDoNotImplementAttribute)) == null) && Attribute(method, typeof(AmqpUnsupportedAttribute)) == null) - { - asynchronousHandlers.Add(method); - } - } - else - { - MaybeEmitModelMethod(method); - } - } - } - } - EmitAsynchronousHandlers(asynchronousHandlers); - EmitLine(" }"); - } - - public void EmitContentHeaderFactory(MethodInfo method) - { - AmqpContentHeaderFactoryAttribute factoryAnnotation = (AmqpContentHeaderFactoryAttribute) - Attribute(method, typeof(AmqpContentHeaderFactoryAttribute)); - string contentClass = factoryAnnotation.m_contentClass; - EmitModelMethodPreamble(method); - EmitLine(" {"); - if (Attribute(method, typeof(AmqpUnsupportedAttribute)) != null) - { - EmitLine($" throw new UnsupportedMethodException(\"{method.Name}\");"); - } - else - { - EmitLine($" return new {MangleClass(contentClass)}Properties();"); - } - EmitLine(" }"); - } - - public void MaybeEmitModelMethod(MethodInfo method) - { - if (method.IsSpecialName) - { - // It's some kind of event- or property-related method. - // It shouldn't be autogenerated. - } - else if (method.Name.EndsWith("NoWait")) - { - // Skip *Nowait versions - } - else if (Attribute(method, typeof(AmqpMethodDoNotImplementAttribute)) != null) - { - // Skip this method, by request (AmqpMethodDoNotImplement) - } - else if (Attribute(method, typeof(AmqpContentHeaderFactoryAttribute)) != null) - { - EmitContentHeaderFactory(method); - } - else if (Attribute(method, typeof(AmqpUnsupportedAttribute)) != null) - { - EmitModelMethodPreamble(method); - EmitLine(" {"); - EmitLine($" throw new UnsupportedMethodException(\"{method.Name}\");"); - EmitLine(" }"); - } - else - { - EmitModelMethod(method); - } - } - - public string SanitisedFullName(Type t) - { - if (t.Equals(typeof(IDictionary))) - { - return "IDictionary"; - } - if (t.Equals(typeof(ReadOnlyMemory))) - { - return "ReadOnlyMemory"; - } - - switch (t.FullName) - { - case "System.Boolean": - return "bool"; - case "System.Byte[]": - return "byte[]"; - case "System.String": - return "string"; - case "System.UInt16": - return "ushort"; - case "System.UInt32": - return "uint"; - case "System.UInt64": - return "ulong"; - case "System.Void": - return "void"; - default: - return t.FullName; - }; - } - - public void EmitModelMethodPreamble(MethodInfo method) - { - ParameterInfo[] parameters = method.GetParameters(); - EmitLine($" public override {SanitisedFullName(method.ReturnType)} {method.Name} ({string.Join(", ", parameters.Select(pi => $"{SanitisedFullName(pi.ParameterType)} @{pi.Name}"))})"); - } - - public void LookupAmqpMethod(MethodInfo method, - string methodName, - out AmqpClass amqpClass, - out AmqpMethod amqpMethod) - { - amqpClass = null; - amqpMethod = null; - - // First, try autodetecting the class/method via the - // IModel method name. - - foreach (AmqpClass c in m_classes) - { - foreach (AmqpMethod m in c.m_Methods) - { - if (methodName.Equals(MangleMethodClass(c, m))) - { - amqpClass = c; - amqpMethod = m; - goto stopSearching; // wheee - } - } - } - stopSearching: - - // If an explicit mapping was provided as an attribute, - // then use that instead, whether the autodetect worked or - // not. - - { - if (Attribute(method, typeof(AmqpMethodMappingAttribute)) is AmqpMethodMappingAttribute methodMapping) - { - amqpClass = null; - foreach (AmqpClass c in m_classes) - { - if (c.Name == methodMapping.m_className) - { - amqpClass = c; - break; - } - } - amqpMethod = amqpClass.MethodNamed(methodMapping.m_methodName); - } - } - - // At this point, if can't find either the class or the - // method, we can't proceed. Complain. - - if (amqpClass == null || amqpMethod == null) - { - throw new Exception($"Could not find AMQP class or method for IModel method {method.Name}"); - } - } - - public void EmitModelMethod(MethodInfo method) - { - ParameterInfo[] parameters = method.GetParameters(); - - LookupAmqpMethod(method, method.Name, out AmqpClass amqpClass, out AmqpMethod amqpMethod); - - string requestImplClass = MangleMethodClass(amqpClass, amqpMethod); - - // At this point, we know which request method to - // send. Now compute whether it's an RPC or not. - - AmqpMethod amqpReplyMethod = null; - AmqpMethodMappingAttribute replyMapping = - Attribute(method.ReturnTypeCustomAttributes, typeof(AmqpMethodMappingAttribute)) - as AmqpMethodMappingAttribute; - if (Attribute(method, typeof(AmqpForceOneWayAttribute)) == null && - (amqpMethod.IsSimpleRpcRequest || replyMapping != null)) - { - // We're not forcing oneway, and either are a simple - // RPC request, or have an explicit replyMapping - amqpReplyMethod = amqpClass.MethodNamed(replyMapping == null - ? amqpMethod.m_ResponseMethods[0] - : replyMapping.m_methodName); - if (amqpReplyMethod == null) - { - throw new Exception($"Could not find AMQP reply method for IModel method {method.Name}"); - } - } - - // If amqpReplyMethod is null at this point, it's a - // one-way operation, and no continuation needs to be - // consed up. Otherwise, we should expect a reply of kind - // identified by amqpReplyMethod - unless there's a nowait - // parameter thrown into the equation! - // - // Examine the parameters to discover which might be - // nowait, content header or content body. - - ParameterInfo nowaitParameter = null; - string nowaitExpression = "null"; - ParameterInfo contentHeaderParameter = null; - ParameterInfo contentBodyParameter = null; - foreach (ParameterInfo pi in parameters) - { - if (Attribute(pi, typeof(AmqpNowaitArgumentAttribute)) is AmqpNowaitArgumentAttribute nwAttr) - { - nowaitParameter = pi; - if (nwAttr.m_replacementExpression != null) - { - nowaitExpression = nwAttr.m_replacementExpression; - } - } - if (Attribute(pi, typeof(AmqpContentHeaderMappingAttribute)) != null) - { - contentHeaderParameter = pi; - } - if (Attribute(pi, typeof(AmqpContentBodyMappingAttribute)) != null) - { - contentBodyParameter = pi; - } - } - - // Compute expression text for the content header and body. - - string contentHeaderExpr = - contentHeaderParameter == null - ? "null" - : $" ({MangleClass(amqpClass.Name)}Properties) {contentHeaderParameter.Name}"; - string contentBodyExpr = - contentBodyParameter == null ? "null" : contentBodyParameter.Name; - - // Emit the method declaration and preamble. - - EmitModelMethodPreamble(method); - EmitLine(" {"); - - // Emit the code to build the request. - if (parameters.Length > 0) - { - foreach (ParameterInfo unsupportedParameter in parameters.Where(x => x.Attribute() != null)) - { - EmitLine($" if (@{unsupportedParameter.Name} != null)"); - EmitLine(" {"); - EmitLine($" throw new UnsupportedMethodFieldException(\"{method.Name}\", \"{unsupportedParameter.Name}\");"); - EmitLine(" }"); - } - EmitLine($" {requestImplClass} __req = new {requestImplClass}()"); - EmitLine(" {"); - foreach (ParameterInfo pi in parameters) - { - if (pi != contentHeaderParameter && pi != contentBodyParameter) - { - if (pi.Attribute() is AmqpFieldMappingAttribute fieldMapping) - { - EmitLine($" _{fieldMapping.m_fieldName} = @{pi.Name},"); - } - else - { - EmitLine($" _{pi.Name} = @{pi.Name},"); - } - } - } - EmitLine(" };"); - } - else - { - EmitLine($" {requestImplClass} __req = new {requestImplClass}();"); - } - - // If we have a nowait parameter, sometimes that can turn - // a ModelRpc call into a ModelSend call. - - if (nowaitParameter != null) - { - EmitLine($" if ({nowaitParameter.Name}) {{"); - EmitLine($" ModelSend(__req,{contentHeaderExpr},{contentBodyExpr});"); - if (method.ReturnType == typeof(void)) - { - EmitLine(" return;"); - } - else - { - EmitLine($" return {nowaitExpression};"); - } - EmitLine(" }"); - } - - // At this point, perform either a ModelRpc or a - // ModelSend. - - if (amqpReplyMethod == null) - { - EmitLine($" ModelSend(__req,{contentHeaderExpr},{contentBodyExpr});"); - } - else - { - string replyImplClass = MangleMethodClass(amqpClass, amqpReplyMethod); - - EmitLine($" Client.Impl.MethodBase __repBase = ModelRpc(__req, {contentHeaderExpr}, {contentBodyExpr});"); - EmitLine($" if (!(__repBase is {replyImplClass}{(method.ReturnType == typeof(void) ? "" : " __rep")}))"); - EmitLine($" {{"); - EmitLine($" throw new UnexpectedMethodException(__repBase);"); - EmitLine($" }}"); - - if (method.ReturnType == typeof(void)) - { - // No need to further examine the reply. - } - else - { - // At this point, we have the reply method. Extract values from it. - if (!(Attribute(method.ReturnTypeCustomAttributes, typeof(AmqpFieldMappingAttribute)) is AmqpFieldMappingAttribute returnMapping)) - { - string fieldPrefix = IsAmqpClass(method.ReturnType) ? "_" : ""; - - // No field mapping --> it's assumed to be a struct to fill in. - EmitLine($" {method.ReturnType} __result = new {method.ReturnType}();"); - foreach (FieldInfo fi in method.ReturnType.GetFields()) - { - if (Attribute(fi, typeof(AmqpFieldMappingAttribute)) is AmqpFieldMappingAttribute returnFieldMapping) - { - EmitLine($" __result.{fi.Name} = __rep.{fieldPrefix}{returnFieldMapping.m_fieldName};"); - } - else - { - EmitLine($" __result.{fi.Name} = __rep.{fieldPrefix}{fi.Name};"); - } - } - EmitLine(" return __result;"); - } - else - { - // Field mapping --> return just the field we're interested in. - EmitLine($" return __rep._{returnMapping.m_fieldName};"); - } - } - } - - // All the IO and result-extraction has been done. Emit - // the method postamble. - - EmitLine(" }"); - } - - public void EmitAsynchronousHandlers(IList asynchronousHandlers) - { - string GetParameterString(ParameterInfo pi) - { - if (Attribute(pi, typeof(AmqpContentHeaderMappingAttribute)) != null) - { - return $"({pi.ParameterType}) cmd.Header"; - } - else if (Attribute(pi, typeof(AmqpContentBodyMappingAttribute)) != null) - { - return "cmd.Body"; - } - else if (Attribute(pi, typeof(AmqpContentBodyArrayMappingAttribute)) != null) - { - return "cmd.TakeoverPayload()"; - } - else - { - return $"__impl._{(!(Attribute(pi, typeof(AmqpFieldMappingAttribute)) is AmqpFieldMappingAttribute fieldMapping) ? pi.Name : fieldMapping.m_fieldName)}"; - } - - throw new NotImplementedException(); - } - - EmitLine(" public override bool DispatchAsynchronous(in IncomingCommand cmd) {"); - EmitLine(" switch ((cmd.Method.ProtocolClassId << 16) | cmd.Method.ProtocolMethodId)"); - EmitLine(" {"); - foreach (MethodInfo method in asynchronousHandlers) - { - string methodName = method.Name; - if (methodName.StartsWith("Handle")) - { - methodName = methodName.Substring(6); - } - - LookupAmqpMethod(method, methodName, out AmqpClass amqpClass, out AmqpMethod amqpMethod); - - string implClass = MangleMethodClass(amqpClass, amqpMethod); - - EmitLine($" case (ClassConstants.{MangleConstant(amqpClass.Name)} << 16) | {MangleClass(amqpClass.Name)}MethodConstants.{MangleConstant(amqpMethod.Name)}:"); - EmitLine(" {"); - ParameterInfo[] parameters = method.GetParameters(); - if (parameters.Length > 0) - { - EmitLine($" var __impl = ({implClass})cmd.Method;"); - EmitLine($" {method.Name}({string.Join(", ", parameters.Select(GetParameterString))});"); - } - else - { - EmitLine($" {method.Name}();"); - } - EmitLine(" return true;"); - EmitLine(" }"); - } - EmitLine(" default: return false;"); - EmitLine(" }"); - EmitLine(" }"); - } - } -} diff --git a/projects/RabbitMQ.Client/RabbitMQ.Client.csproj b/projects/RabbitMQ.Client/RabbitMQ.Client.csproj index ebe5081ffb..2af20d6c4d 100755 --- a/projects/RabbitMQ.Client/RabbitMQ.Client.csproj +++ b/projects/RabbitMQ.Client/RabbitMQ.Client.csproj @@ -44,7 +44,6 @@ - diff --git a/projects/RabbitMQ.Client/client/framing/BasicAck.cs b/projects/RabbitMQ.Client/client/framing/BasicAck.cs new file mode 100644 index 0000000000..2bf2f79ad2 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/BasicAck.cs @@ -0,0 +1,84 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class BasicAck : Client.Impl.MethodBase + { + public ulong _deliveryTag; + public bool _multiple; + + ulong DeliveryTag => _deliveryTag; + bool Multiple => _multiple; + + public BasicAck() {} + public BasicAck(ulong @DeliveryTag, bool @Multiple) + { + _deliveryTag = @DeliveryTag; + _multiple = @Multiple; + } + + public override ushort ProtocolClassId => ClassConstants.Basic; + public override ushort ProtocolMethodId => BasicMethodConstants.Ack; + public override string ProtocolMethodName => "basic.ack"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _deliveryTag = reader.ReadLonglong(); + _multiple = reader.ReadBit(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteLonglong(_deliveryTag); + writer.WriteBit(_multiple); + writer.EndBits(); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 9; // bytes for _deliveryTag, bit fields + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_deliveryTag).Append(','); + sb.Append(_multiple); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/BasicCancel.cs b/projects/RabbitMQ.Client/client/framing/BasicCancel.cs new file mode 100644 index 0000000000..a65d4c4f2a --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/BasicCancel.cs @@ -0,0 +1,85 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class BasicCancel : Client.Impl.MethodBase + { + public string _consumerTag; + public bool _nowait; + + string ConsumerTag => _consumerTag; + bool Nowait => _nowait; + + public BasicCancel() {} + public BasicCancel(string @ConsumerTag, bool @Nowait) + { + _consumerTag = @ConsumerTag; + _nowait = @Nowait; + } + + public override ushort ProtocolClassId => ClassConstants.Basic; + public override ushort ProtocolMethodId => BasicMethodConstants.Cancel; + public override string ProtocolMethodName => "basic.cancel"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _consumerTag = reader.ReadShortstr(); + _nowait = reader.ReadBit(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteShortstr(_consumerTag); + writer.WriteBit(_nowait); + writer.EndBits(); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 2; // bytes for length of _consumerTag, bit fields + bufferSize += Encoding.UTF8.GetByteCount(_consumerTag); // _consumerTag in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_consumerTag).Append(','); + sb.Append(_nowait); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/BasicCancelOk.cs b/projects/RabbitMQ.Client/client/framing/BasicCancelOk.cs new file mode 100644 index 0000000000..64fc1837e7 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/BasicCancelOk.cs @@ -0,0 +1,78 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class BasicCancelOk : Client.Impl.MethodBase + { + public string _consumerTag; + + string ConsumerTag => _consumerTag; + + public BasicCancelOk() {} + public BasicCancelOk(string @ConsumerTag) + { + _consumerTag = @ConsumerTag; + } + + public override ushort ProtocolClassId => ClassConstants.Basic; + public override ushort ProtocolMethodId => BasicMethodConstants.CancelOk; + public override string ProtocolMethodName => "basic.cancel-ok"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _consumerTag = reader.ReadShortstr(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteShortstr(_consumerTag); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 1; // bytes for length of _consumerTag + bufferSize += Encoding.UTF8.GetByteCount(_consumerTag); // _consumerTag in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_consumerTag); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/BasicConsume.cs b/projects/RabbitMQ.Client/client/framing/BasicConsume.cs new file mode 100644 index 0000000000..a1d675e294 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/BasicConsume.cs @@ -0,0 +1,125 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Collections.Generic; +using System.Text; +using RabbitMQ.Client.Impl; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class BasicConsume : Client.Impl.MethodBase + { + public ushort _reserved1; + public string _queue; + public string _consumerTag; + public bool _noLocal; + public bool _noAck; + public bool _exclusive; + public bool _nowait; + public IDictionary _arguments; + + ushort Reserved1 => _reserved1; + string Queue => _queue; + string ConsumerTag => _consumerTag; + bool NoLocal => _noLocal; + bool NoAck => _noAck; + bool Exclusive => _exclusive; + bool Nowait => _nowait; + IDictionary Arguments => _arguments; + + public BasicConsume() {} + public BasicConsume(ushort @Reserved1, string @Queue, string @ConsumerTag, bool @NoLocal, bool @NoAck, bool @Exclusive, bool @Nowait, IDictionary @Arguments) + { + _reserved1 = @Reserved1; + _queue = @Queue; + _consumerTag = @ConsumerTag; + _noLocal = @NoLocal; + _noAck = @NoAck; + _exclusive = @Exclusive; + _nowait = @Nowait; + _arguments = @Arguments; + } + + public override ushort ProtocolClassId => ClassConstants.Basic; + public override ushort ProtocolMethodId => BasicMethodConstants.Consume; + public override string ProtocolMethodName => "basic.consume"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _reserved1 = reader.ReadShort(); + _queue = reader.ReadShortstr(); + _consumerTag = reader.ReadShortstr(); + _noLocal = reader.ReadBit(); + _noAck = reader.ReadBit(); + _exclusive = reader.ReadBit(); + _nowait = reader.ReadBit(); + _arguments = reader.ReadTable(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteShort(_reserved1); + writer.WriteShortstr(_queue); + writer.WriteShortstr(_consumerTag); + writer.WriteBit(_noLocal); + writer.WriteBit(_noAck); + writer.WriteBit(_exclusive); + writer.WriteBit(_nowait); + writer.EndBits(); + writer.WriteTable(_arguments); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 5; // bytes for _reserved1, length of _queue, length of _consumerTag, bit fields + bufferSize += Encoding.UTF8.GetByteCount(_queue); // _queue in bytes + bufferSize += Encoding.UTF8.GetByteCount(_consumerTag); // _consumerTag in bytes + bufferSize += WireFormatting.GetTableByteCount(_arguments); // _arguments in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_reserved1).Append(','); + sb.Append(_queue).Append(','); + sb.Append(_consumerTag).Append(','); + sb.Append(_noLocal).Append(','); + sb.Append(_noAck).Append(','); + sb.Append(_exclusive).Append(','); + sb.Append(_nowait).Append(','); + sb.Append(_arguments); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/BasicConsumeOk.cs b/projects/RabbitMQ.Client/client/framing/BasicConsumeOk.cs new file mode 100644 index 0000000000..3dc82e6068 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/BasicConsumeOk.cs @@ -0,0 +1,78 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class BasicConsumeOk : Client.Impl.MethodBase + { + public string _consumerTag; + + string ConsumerTag => _consumerTag; + + public BasicConsumeOk() {} + public BasicConsumeOk(string @ConsumerTag) + { + _consumerTag = @ConsumerTag; + } + + public override ushort ProtocolClassId => ClassConstants.Basic; + public override ushort ProtocolMethodId => BasicMethodConstants.ConsumeOk; + public override string ProtocolMethodName => "basic.consume-ok"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _consumerTag = reader.ReadShortstr(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteShortstr(_consumerTag); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 1; // bytes for length of _consumerTag + bufferSize += Encoding.UTF8.GetByteCount(_consumerTag); // _consumerTag in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_consumerTag); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/BasicDeliver.cs b/projects/RabbitMQ.Client/client/framing/BasicDeliver.cs new file mode 100644 index 0000000000..5ed57fdd3c --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/BasicDeliver.cs @@ -0,0 +1,105 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class BasicDeliver : Client.Impl.MethodBase + { + public string _consumerTag; + public ulong _deliveryTag; + public bool _redelivered; + public string _exchange; + public string _routingKey; + + string ConsumerTag => _consumerTag; + ulong DeliveryTag => _deliveryTag; + bool Redelivered => _redelivered; + string Exchange => _exchange; + string RoutingKey => _routingKey; + + public BasicDeliver() {} + public BasicDeliver(string @ConsumerTag, ulong @DeliveryTag, bool @Redelivered, string @Exchange, string @RoutingKey) + { + _consumerTag = @ConsumerTag; + _deliveryTag = @DeliveryTag; + _redelivered = @Redelivered; + _exchange = @Exchange; + _routingKey = @RoutingKey; + } + + public override ushort ProtocolClassId => ClassConstants.Basic; + public override ushort ProtocolMethodId => BasicMethodConstants.Deliver; + public override string ProtocolMethodName => "basic.deliver"; + public override bool HasContent => true; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _consumerTag = reader.ReadShortstr(); + _deliveryTag = reader.ReadLonglong(); + _redelivered = reader.ReadBit(); + _exchange = reader.ReadShortstr(); + _routingKey = reader.ReadShortstr(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteShortstr(_consumerTag); + writer.WriteLonglong(_deliveryTag); + writer.WriteBit(_redelivered); + writer.EndBits(); + writer.WriteShortstr(_exchange); + writer.WriteShortstr(_routingKey); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 12; // bytes for length of _consumerTag, _deliveryTag, bit fields, length of _exchange, length of _routingKey + bufferSize += Encoding.UTF8.GetByteCount(_consumerTag); // _consumerTag in bytes + bufferSize += Encoding.UTF8.GetByteCount(_exchange); // _exchange in bytes + bufferSize += Encoding.UTF8.GetByteCount(_routingKey); // _routingKey in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_consumerTag).Append(','); + sb.Append(_deliveryTag).Append(','); + sb.Append(_redelivered).Append(','); + sb.Append(_exchange).Append(','); + sb.Append(_routingKey); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/BasicGet.cs b/projects/RabbitMQ.Client/client/framing/BasicGet.cs new file mode 100644 index 0000000000..eb0d1a3f66 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/BasicGet.cs @@ -0,0 +1,91 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class BasicGet : Client.Impl.MethodBase + { + public ushort _reserved1; + public string _queue; + public bool _noAck; + + ushort Reserved1 => _reserved1; + string Queue => _queue; + bool NoAck => _noAck; + + public BasicGet() {} + public BasicGet(ushort @Reserved1, string @Queue, bool @NoAck) + { + _reserved1 = @Reserved1; + _queue = @Queue; + _noAck = @NoAck; + } + + public override ushort ProtocolClassId => ClassConstants.Basic; + public override ushort ProtocolMethodId => BasicMethodConstants.Get; + public override string ProtocolMethodName => "basic.get"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _reserved1 = reader.ReadShort(); + _queue = reader.ReadShortstr(); + _noAck = reader.ReadBit(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteShort(_reserved1); + writer.WriteShortstr(_queue); + writer.WriteBit(_noAck); + writer.EndBits(); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 4; // bytes for _reserved1, length of _queue, bit fields + bufferSize += Encoding.UTF8.GetByteCount(_queue); // _queue in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_reserved1).Append(','); + sb.Append(_queue).Append(','); + sb.Append(_noAck); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/BasicGetEmpty.cs b/projects/RabbitMQ.Client/client/framing/BasicGetEmpty.cs new file mode 100644 index 0000000000..3d7379f4e1 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/BasicGetEmpty.cs @@ -0,0 +1,78 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class BasicGetEmpty : Client.Impl.MethodBase + { + public string _reserved1; + + string Reserved1 => _reserved1; + + public BasicGetEmpty() {} + public BasicGetEmpty(string @Reserved1) + { + _reserved1 = @Reserved1; + } + + public override ushort ProtocolClassId => ClassConstants.Basic; + public override ushort ProtocolMethodId => BasicMethodConstants.GetEmpty; + public override string ProtocolMethodName => "basic.get-empty"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _reserved1 = reader.ReadShortstr(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteShortstr(_reserved1); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 1; // bytes for length of _reserved1 + bufferSize += Encoding.UTF8.GetByteCount(_reserved1); // _reserved1 in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_reserved1); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/BasicGetOk.cs b/projects/RabbitMQ.Client/client/framing/BasicGetOk.cs new file mode 100644 index 0000000000..e961483453 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/BasicGetOk.cs @@ -0,0 +1,104 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class BasicGetOk : Client.Impl.MethodBase + { + public ulong _deliveryTag; + public bool _redelivered; + public string _exchange; + public string _routingKey; + public uint _messageCount; + + ulong DeliveryTag => _deliveryTag; + bool Redelivered => _redelivered; + string Exchange => _exchange; + string RoutingKey => _routingKey; + uint MessageCount => _messageCount; + + public BasicGetOk() {} + public BasicGetOk(ulong @DeliveryTag, bool @Redelivered, string @Exchange, string @RoutingKey, uint @MessageCount) + { + _deliveryTag = @DeliveryTag; + _redelivered = @Redelivered; + _exchange = @Exchange; + _routingKey = @RoutingKey; + _messageCount = @MessageCount; + } + + public override ushort ProtocolClassId => ClassConstants.Basic; + public override ushort ProtocolMethodId => BasicMethodConstants.GetOk; + public override string ProtocolMethodName => "basic.get-ok"; + public override bool HasContent => true; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _deliveryTag = reader.ReadLonglong(); + _redelivered = reader.ReadBit(); + _exchange = reader.ReadShortstr(); + _routingKey = reader.ReadShortstr(); + _messageCount = reader.ReadLong(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteLonglong(_deliveryTag); + writer.WriteBit(_redelivered); + writer.EndBits(); + writer.WriteShortstr(_exchange); + writer.WriteShortstr(_routingKey); + writer.WriteLong(_messageCount); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 15; // bytes for _deliveryTag, bit fields, length of _exchange, length of _routingKey, _messageCount + bufferSize += Encoding.UTF8.GetByteCount(_exchange); // _exchange in bytes + bufferSize += Encoding.UTF8.GetByteCount(_routingKey); // _routingKey in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_deliveryTag).Append(','); + sb.Append(_redelivered).Append(','); + sb.Append(_exchange).Append(','); + sb.Append(_routingKey).Append(','); + sb.Append(_messageCount); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/BasicMethodConstants.cs b/projects/RabbitMQ.Client/client/framing/BasicMethodConstants.cs new file mode 100644 index 0000000000..32008fc9b1 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/BasicMethodConstants.cs @@ -0,0 +1,55 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +namespace RabbitMQ.Client.Framing.Impl +{ + internal static class BasicMethodConstants + { + internal const ushort Qos = 10; + internal const ushort QosOk = 11; + internal const ushort Consume = 20; + internal const ushort ConsumeOk = 21; + internal const ushort Cancel = 30; + internal const ushort CancelOk = 31; + internal const ushort Publish = 40; + internal const ushort Return = 50; + internal const ushort Deliver = 60; + internal const ushort Get = 70; + internal const ushort GetOk = 71; + internal const ushort GetEmpty = 72; + internal const ushort Ack = 80; + internal const ushort Reject = 90; + internal const ushort RecoverAsync = 100; + internal const ushort Recover = 110; + internal const ushort RecoverOk = 111; + internal const ushort Nack = 120; + } +} diff --git a/projects/RabbitMQ.Client/client/framing/BasicNack.cs b/projects/RabbitMQ.Client/client/framing/BasicNack.cs new file mode 100644 index 0000000000..2e819095a6 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/BasicNack.cs @@ -0,0 +1,90 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class BasicNack : Client.Impl.MethodBase + { + public ulong _deliveryTag; + public bool _multiple; + public bool _requeue; + + ulong DeliveryTag => _deliveryTag; + bool Multiple => _multiple; + bool Requeue => _requeue; + + public BasicNack() {} + public BasicNack(ulong @DeliveryTag, bool @Multiple, bool @Requeue) + { + _deliveryTag = @DeliveryTag; + _multiple = @Multiple; + _requeue = @Requeue; + } + + public override ushort ProtocolClassId => ClassConstants.Basic; + public override ushort ProtocolMethodId => BasicMethodConstants.Nack; + public override string ProtocolMethodName => "basic.nack"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _deliveryTag = reader.ReadLonglong(); + _multiple = reader.ReadBit(); + _requeue = reader.ReadBit(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteLonglong(_deliveryTag); + writer.WriteBit(_multiple); + writer.WriteBit(_requeue); + writer.EndBits(); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 9; // bytes for _deliveryTag, bit fields + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_deliveryTag).Append(','); + sb.Append(_multiple).Append(','); + sb.Append(_requeue); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/BasicProperties.cs b/projects/RabbitMQ.Client/client/framing/BasicProperties.cs new file mode 100644 index 0000000000..cf37d83dc3 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/BasicProperties.cs @@ -0,0 +1,306 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Collections.Generic; +using System.Text; +using RabbitMQ.Client.Impl; + +namespace RabbitMQ.Client.Framing +{ + /// Autogenerated type. AMQP specification content header properties for content class "basic" + internal sealed class BasicProperties : RabbitMQ.Client.Impl.BasicProperties + { + private string _contentType; + private string _contentEncoding; + private IDictionary _headers; + private byte _deliveryMode; + private byte _priority; + private string _correlationId; + private string _replyTo; + private string _expiration; + private string _messageId; + private AmqpTimestamp _timestamp; + private string _type; + private string _userId; + private string _appId; + private string _clusterId; + + public override string ContentType + { + get => _contentType; + set => _contentType = value; + } + + public override string ContentEncoding + { + get => _contentEncoding; + set => _contentEncoding = value; + } + + public override IDictionary Headers + { + get => _headers; + set => _headers = value; + } + + public override byte DeliveryMode + { + get => _deliveryMode; + set => _deliveryMode = value; + } + + public override byte Priority + { + get => _priority; + set => _priority = value; + } + + public override string CorrelationId + { + get => _correlationId; + set => _correlationId = value; + } + + public override string ReplyTo + { + get => _replyTo; + set => _replyTo = value; + } + + public override string Expiration + { + get => _expiration; + set => _expiration = value; + } + + public override string MessageId + { + get => _messageId; + set => _messageId = value; + } + + public override AmqpTimestamp Timestamp + { + get => _timestamp; + set => _timestamp = value; + } + + public override string Type + { + get => _type; + set => _type = value; + } + + public override string UserId + { + get => _userId; + set => _userId = value; + } + + public override string AppId + { + get => _appId; + set => _appId = value; + } + + public override string ClusterId + { + get => _clusterId; + set => _clusterId = value; + } + + public override void ClearContentType() => _contentType = default; + + public override void ClearContentEncoding() => _contentEncoding = default; + + public override void ClearHeaders() => _headers = default; + + public override void ClearDeliveryMode() => _deliveryMode = default; + + public override void ClearPriority() => _priority = default; + + public override void ClearCorrelationId() => _correlationId = default; + + public override void ClearReplyTo() => _replyTo = default; + + public override void ClearExpiration() => _expiration = default; + + public override void ClearMessageId() => _messageId = default; + + public override void ClearTimestamp() => _timestamp = default; + + public override void ClearType() => _type = default; + + public override void ClearUserId() => _userId = default; + + public override void ClearAppId() => _appId = default; + + public override void ClearClusterId() => _clusterId = default; + + public override bool IsContentTypePresent() => _contentType != default; + + public override bool IsContentEncodingPresent() => _contentEncoding != default; + + public override bool IsHeadersPresent() => _headers != default; + + public override bool IsDeliveryModePresent() => _deliveryMode != default; + + public override bool IsPriorityPresent() => _priority != default; + + public override bool IsCorrelationIdPresent() => _correlationId != default; + + public override bool IsReplyToPresent() => _replyTo != default; + + public override bool IsExpirationPresent() => _expiration != default; + + public override bool IsMessageIdPresent() => _messageId != default; + + public override bool IsTimestampPresent() => _timestamp != default; + + public override bool IsTypePresent() => _type != default; + + public override bool IsUserIdPresent() => _userId != default; + + public override bool IsAppIdPresent() => _appId != default; + + public override bool IsClusterIdPresent() => _clusterId != default; + + public BasicProperties() { } + public override ushort ProtocolClassId => 60; + public override string ProtocolClassName => "basic"; + + internal override void ReadPropertiesFrom(ref Client.Impl.ContentHeaderPropertyReader reader) + { + var contentType_present = reader.ReadPresence(); + var contentEncoding_present = reader.ReadPresence(); + var headers_present = reader.ReadPresence(); + var deliveryMode_present = reader.ReadPresence(); + var priority_present = reader.ReadPresence(); + var correlationId_present = reader.ReadPresence(); + var replyTo_present = reader.ReadPresence(); + var expiration_present = reader.ReadPresence(); + var messageId_present = reader.ReadPresence(); + var timestamp_present = reader.ReadPresence(); + var type_present = reader.ReadPresence(); + var userId_present = reader.ReadPresence(); + var appId_present = reader.ReadPresence(); + var clusterId_present = reader.ReadPresence(); + reader.FinishPresence(); + if (contentType_present) { _contentType = reader.ReadShortstr(); } + if (contentEncoding_present) { _contentEncoding = reader.ReadShortstr(); } + if (headers_present) { _headers = reader.ReadTable(); } + if (deliveryMode_present) { _deliveryMode = reader.ReadOctet(); } + if (priority_present) { _priority = reader.ReadOctet(); } + if (correlationId_present) { _correlationId = reader.ReadShortstr(); } + if (replyTo_present) { _replyTo = reader.ReadShortstr(); } + if (expiration_present) { _expiration = reader.ReadShortstr(); } + if (messageId_present) { _messageId = reader.ReadShortstr(); } + if (timestamp_present) { _timestamp = reader.ReadTimestamp(); } + if (type_present) { _type = reader.ReadShortstr(); } + if (userId_present) { _userId = reader.ReadShortstr(); } + if (appId_present) { _appId = reader.ReadShortstr(); } + if (clusterId_present) { _clusterId = reader.ReadShortstr(); } + } + + internal override void WritePropertiesTo(ref Client.Impl.ContentHeaderPropertyWriter writer) + { + writer.WritePresence(IsContentTypePresent()); + writer.WritePresence(IsContentEncodingPresent()); + writer.WritePresence(IsHeadersPresent()); + writer.WritePresence(IsDeliveryModePresent()); + writer.WritePresence(IsPriorityPresent()); + writer.WritePresence(IsCorrelationIdPresent()); + writer.WritePresence(IsReplyToPresent()); + writer.WritePresence(IsExpirationPresent()); + writer.WritePresence(IsMessageIdPresent()); + writer.WritePresence(IsTimestampPresent()); + writer.WritePresence(IsTypePresent()); + writer.WritePresence(IsUserIdPresent()); + writer.WritePresence(IsAppIdPresent()); + writer.WritePresence(IsClusterIdPresent()); + writer.FinishPresence(); + if (IsContentTypePresent()) { writer.WriteShortstr(_contentType); } + if (IsContentEncodingPresent()) { writer.WriteShortstr(_contentEncoding); } + if (IsHeadersPresent()) { writer.WriteTable(_headers); } + if (IsDeliveryModePresent()) { writer.WriteOctet(_deliveryMode); } + if (IsPriorityPresent()) { writer.WriteOctet(_priority); } + if (IsCorrelationIdPresent()) { writer.WriteShortstr(_correlationId); } + if (IsReplyToPresent()) { writer.WriteShortstr(_replyTo); } + if (IsExpirationPresent()) { writer.WriteShortstr(_expiration); } + if (IsMessageIdPresent()) { writer.WriteShortstr(_messageId); } + if (IsTimestampPresent()) { writer.WriteTimestamp(_timestamp); } + if (IsTypePresent()) { writer.WriteShortstr(_type); } + if (IsUserIdPresent()) { writer.WriteShortstr(_userId); } + if (IsAppIdPresent()) { writer.WriteShortstr(_appId); } + if (IsClusterIdPresent()) { writer.WriteShortstr(_clusterId); } + } + + public override int GetRequiredPayloadBufferSize() + { + int bufferSize = 2; // number of presence fields (14) in 2 bytes blocks + if (IsContentTypePresent()) { bufferSize += 1 + Encoding.UTF8.GetByteCount(_contentType); } // _contentType in bytes + if (IsContentEncodingPresent()) { bufferSize += 1 + Encoding.UTF8.GetByteCount(_contentEncoding); } // _contentEncoding in bytes + if (IsHeadersPresent()) { bufferSize += WireFormatting.GetTableByteCount(_headers); } // _headers in bytes + if (IsDeliveryModePresent()) { bufferSize++; } // _deliveryMode in bytes + if (IsPriorityPresent()) { bufferSize++; } // _priority in bytes + if (IsCorrelationIdPresent()) { bufferSize += 1 + Encoding.UTF8.GetByteCount(_correlationId); } // _correlationId in bytes + if (IsReplyToPresent()) { bufferSize += 1 + Encoding.UTF8.GetByteCount(_replyTo); } // _replyTo in bytes + if (IsExpirationPresent()) { bufferSize += 1 + Encoding.UTF8.GetByteCount(_expiration); } // _expiration in bytes + if (IsMessageIdPresent()) { bufferSize += 1 + Encoding.UTF8.GetByteCount(_messageId); } // _messageId in bytes + if (IsTimestampPresent()) { bufferSize += 8; } // _timestamp in bytes + if (IsTypePresent()) { bufferSize += 1 + Encoding.UTF8.GetByteCount(_type); } // _type in bytes + if (IsUserIdPresent()) { bufferSize += 1 + Encoding.UTF8.GetByteCount(_userId); } // _userId in bytes + if (IsAppIdPresent()) { bufferSize += 1 + Encoding.UTF8.GetByteCount(_appId); } // _appId in bytes + if (IsClusterIdPresent()) { bufferSize += 1 + Encoding.UTF8.GetByteCount(_clusterId); } // _clusterId in bytes + return bufferSize; + } + + public override void AppendPropertyDebugStringTo(StringBuilder sb) + { + sb.Append("("); + sb.Append("content-type=").Append(IsContentTypePresent() ? _contentType.ToString() : "_").Append(", "); + sb.Append("content-encoding=").Append(IsContentEncodingPresent() ? _contentEncoding.ToString() : "_").Append(", "); + sb.Append("headers=").Append(IsHeadersPresent() ? _headers.ToString() : "_").Append(", "); + sb.Append("delivery-mode=").Append(IsDeliveryModePresent() ? _deliveryMode.ToString() : "_").Append(", "); + sb.Append("priority=").Append(IsPriorityPresent() ? _priority.ToString() : "_").Append(", "); + sb.Append("correlation-id=").Append(IsCorrelationIdPresent() ? _correlationId.ToString() : "_").Append(", "); + sb.Append("reply-to=").Append(IsReplyToPresent() ? _replyTo.ToString() : "_").Append(", "); + sb.Append("expiration=").Append(IsExpirationPresent() ? _expiration.ToString() : "_").Append(", "); + sb.Append("message-id=").Append(IsMessageIdPresent() ? _messageId.ToString() : "_").Append(", "); + sb.Append("timestamp=").Append(IsTimestampPresent() ? _timestamp.ToString() : "_").Append(", "); + sb.Append("type=").Append(IsTypePresent() ? _type.ToString() : "_").Append(", "); + sb.Append("user-id=").Append(IsUserIdPresent() ? _userId.ToString() : "_").Append(", "); + sb.Append("app-id=").Append(IsAppIdPresent() ? _appId.ToString() : "_").Append(", "); + sb.Append("cluster-id=").Append(IsClusterIdPresent() ? _clusterId.ToString() : "_"); + sb.Append(")"); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/BasicPublish.cs b/projects/RabbitMQ.Client/client/framing/BasicPublish.cs new file mode 100644 index 0000000000..35711bd12f --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/BasicPublish.cs @@ -0,0 +1,104 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class BasicPublish : Client.Impl.MethodBase + { + public ushort _reserved1; + public string _exchange; + public string _routingKey; + public bool _mandatory; + public bool _immediate; + + ushort Reserved1 => _reserved1; + string Exchange => _exchange; + string RoutingKey => _routingKey; + bool Mandatory => _mandatory; + bool Immediate => _immediate; + + public BasicPublish() {} + public BasicPublish(ushort @Reserved1, string @Exchange, string @RoutingKey, bool @Mandatory, bool @Immediate) + { + _reserved1 = @Reserved1; + _exchange = @Exchange; + _routingKey = @RoutingKey; + _mandatory = @Mandatory; + _immediate = @Immediate; + } + + public override ushort ProtocolClassId => ClassConstants.Basic; + public override ushort ProtocolMethodId => BasicMethodConstants.Publish; + public override string ProtocolMethodName => "basic.publish"; + public override bool HasContent => true; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _reserved1 = reader.ReadShort(); + _exchange = reader.ReadShortstr(); + _routingKey = reader.ReadShortstr(); + _mandatory = reader.ReadBit(); + _immediate = reader.ReadBit(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteShort(_reserved1); + writer.WriteShortstr(_exchange); + writer.WriteShortstr(_routingKey); + writer.WriteBit(_mandatory); + writer.WriteBit(_immediate); + writer.EndBits(); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 5; // bytes for _reserved1, length of _exchange, length of _routingKey, bit fields + bufferSize += Encoding.UTF8.GetByteCount(_exchange); // _exchange in bytes + bufferSize += Encoding.UTF8.GetByteCount(_routingKey); // _routingKey in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_reserved1).Append(','); + sb.Append(_exchange).Append(','); + sb.Append(_routingKey).Append(','); + sb.Append(_mandatory).Append(','); + sb.Append(_immediate); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/BasicQos.cs b/projects/RabbitMQ.Client/client/framing/BasicQos.cs new file mode 100644 index 0000000000..cf70ee8439 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/BasicQos.cs @@ -0,0 +1,90 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class BasicQos : Client.Impl.MethodBase + { + public uint _prefetchSize; + public ushort _prefetchCount; + public bool _global; + + uint PrefetchSize => _prefetchSize; + ushort PrefetchCount => _prefetchCount; + bool Global => _global; + + public BasicQos() {} + public BasicQos(uint @PrefetchSize, ushort @PrefetchCount, bool @Global) + { + _prefetchSize = @PrefetchSize; + _prefetchCount = @PrefetchCount; + _global = @Global; + } + + public override ushort ProtocolClassId => ClassConstants.Basic; + public override ushort ProtocolMethodId => BasicMethodConstants.Qos; + public override string ProtocolMethodName => "basic.qos"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _prefetchSize = reader.ReadLong(); + _prefetchCount = reader.ReadShort(); + _global = reader.ReadBit(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteLong(_prefetchSize); + writer.WriteShort(_prefetchCount); + writer.WriteBit(_global); + writer.EndBits(); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 7; // bytes for _prefetchSize, _prefetchCount, bit fields + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_prefetchSize).Append(','); + sb.Append(_prefetchCount).Append(','); + sb.Append(_global); + sb.Append(')'); + } + } +} diff --git a/projects/Apigen/apigen/AmqpClass.cs b/projects/RabbitMQ.Client/client/framing/BasicQosOk.cs similarity index 55% rename from projects/Apigen/apigen/AmqpClass.cs rename to projects/RabbitMQ.Client/client/framing/BasicQosOk.cs index 559b4a3e5a..14af3430ba 100644 --- a/projects/Apigen/apigen/AmqpClass.cs +++ b/projects/RabbitMQ.Client/client/framing/BasicQosOk.cs @@ -29,51 +29,42 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Collections.Generic; -using System.Xml; +using System.Text; -namespace RabbitMQ.Client.Apigen +namespace RabbitMQ.Client.Framing.Impl { - public class AmqpClass: AmqpEntity { - public IList m_Methods; - public IList m_Fields; + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class BasicQosOk : Client.Impl.MethodBase + { - public AmqpClass(XmlNode n) - : base(n) + + public BasicQosOk() + { + } + + public override ushort ProtocolClassId => ClassConstants.Basic; + public override ushort ProtocolMethodId => BasicMethodConstants.QosOk; + public override string ProtocolMethodName => "basic.qos-ok"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) { - m_Methods = new List(); - foreach (XmlNode m in n.SelectNodes("method")) { - m_Methods.Add(new AmqpMethod(m)); - } - m_Fields = new List(); - foreach (XmlNode f in n.SelectNodes("field")) { - m_Fields.Add(new AmqpField(f)); - } } - public int Index { - get { - return GetInt("@index"); - } + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { } - public bool NeedsProperties { - get { - foreach (AmqpMethod m in m_Methods) { - if (m.HasContent) return true; - } - return false; - } + public override int GetRequiredBufferSize() + { + int bufferSize = 0; + return bufferSize; } - public AmqpMethod MethodNamed(string name) { - foreach (AmqpMethod m in m_Methods) - { - if (m.Name == name) { - return m; - } - } - return null; + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(')'); } } } diff --git a/projects/RabbitMQ.Client/client/framing/BasicRecover.cs b/projects/RabbitMQ.Client/client/framing/BasicRecover.cs new file mode 100644 index 0000000000..0e6d7faadb --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/BasicRecover.cs @@ -0,0 +1,78 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class BasicRecover : Client.Impl.MethodBase + { + public bool _requeue; + + bool Requeue => _requeue; + + public BasicRecover() {} + public BasicRecover(bool @Requeue) + { + _requeue = @Requeue; + } + + public override ushort ProtocolClassId => ClassConstants.Basic; + public override ushort ProtocolMethodId => BasicMethodConstants.Recover; + public override string ProtocolMethodName => "basic.recover"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _requeue = reader.ReadBit(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteBit(_requeue); + writer.EndBits(); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 1; // bytes for bit fields + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_requeue); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/BasicRecoverAsync.cs b/projects/RabbitMQ.Client/client/framing/BasicRecoverAsync.cs new file mode 100644 index 0000000000..bf8df13296 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/BasicRecoverAsync.cs @@ -0,0 +1,78 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class BasicRecoverAsync : Client.Impl.MethodBase + { + public bool _requeue; + + bool Requeue => _requeue; + + public BasicRecoverAsync() {} + public BasicRecoverAsync(bool @Requeue) + { + _requeue = @Requeue; + } + + public override ushort ProtocolClassId => ClassConstants.Basic; + public override ushort ProtocolMethodId => BasicMethodConstants.RecoverAsync; + public override string ProtocolMethodName => "basic.recover-async"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _requeue = reader.ReadBit(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteBit(_requeue); + writer.EndBits(); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 1; // bytes for bit fields + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_requeue); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/BasicRecoverOk.cs b/projects/RabbitMQ.Client/client/framing/BasicRecoverOk.cs new file mode 100644 index 0000000000..8fbfd3c217 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/BasicRecoverOk.cs @@ -0,0 +1,70 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class BasicRecoverOk : Client.Impl.MethodBase + { + + + public BasicRecoverOk() + { + } + + public override ushort ProtocolClassId => ClassConstants.Basic; + public override ushort ProtocolMethodId => BasicMethodConstants.RecoverOk; + public override string ProtocolMethodName => "basic.recover-ok"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 0; + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/BasicReject.cs b/projects/RabbitMQ.Client/client/framing/BasicReject.cs new file mode 100644 index 0000000000..342389eff2 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/BasicReject.cs @@ -0,0 +1,84 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class BasicReject : Client.Impl.MethodBase + { + public ulong _deliveryTag; + public bool _requeue; + + ulong DeliveryTag => _deliveryTag; + bool Requeue => _requeue; + + public BasicReject() {} + public BasicReject(ulong @DeliveryTag, bool @Requeue) + { + _deliveryTag = @DeliveryTag; + _requeue = @Requeue; + } + + public override ushort ProtocolClassId => ClassConstants.Basic; + public override ushort ProtocolMethodId => BasicMethodConstants.Reject; + public override string ProtocolMethodName => "basic.reject"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _deliveryTag = reader.ReadLonglong(); + _requeue = reader.ReadBit(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteLonglong(_deliveryTag); + writer.WriteBit(_requeue); + writer.EndBits(); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 9; // bytes for _deliveryTag, bit fields + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_deliveryTag).Append(','); + sb.Append(_requeue); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/BasicReturn.cs b/projects/RabbitMQ.Client/client/framing/BasicReturn.cs new file mode 100644 index 0000000000..e2b25524d4 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/BasicReturn.cs @@ -0,0 +1,98 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class BasicReturn : Client.Impl.MethodBase + { + public ushort _replyCode; + public string _replyText; + public string _exchange; + public string _routingKey; + + ushort ReplyCode => _replyCode; + string ReplyText => _replyText; + string Exchange => _exchange; + string RoutingKey => _routingKey; + + public BasicReturn() {} + public BasicReturn(ushort @ReplyCode, string @ReplyText, string @Exchange, string @RoutingKey) + { + _replyCode = @ReplyCode; + _replyText = @ReplyText; + _exchange = @Exchange; + _routingKey = @RoutingKey; + } + + public override ushort ProtocolClassId => ClassConstants.Basic; + public override ushort ProtocolMethodId => BasicMethodConstants.Return; + public override string ProtocolMethodName => "basic.return"; + public override bool HasContent => true; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _replyCode = reader.ReadShort(); + _replyText = reader.ReadShortstr(); + _exchange = reader.ReadShortstr(); + _routingKey = reader.ReadShortstr(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteShort(_replyCode); + writer.WriteShortstr(_replyText); + writer.WriteShortstr(_exchange); + writer.WriteShortstr(_routingKey); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 5; // bytes for _replyCode, length of _replyText, length of _exchange, length of _routingKey + bufferSize += Encoding.UTF8.GetByteCount(_replyText); // _replyText in bytes + bufferSize += Encoding.UTF8.GetByteCount(_exchange); // _exchange in bytes + bufferSize += Encoding.UTF8.GetByteCount(_routingKey); // _routingKey in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_replyCode).Append(','); + sb.Append(_replyText).Append(','); + sb.Append(_exchange).Append(','); + sb.Append(_routingKey); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ChannelClose.cs b/projects/RabbitMQ.Client/client/framing/ChannelClose.cs new file mode 100644 index 0000000000..cea1403759 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ChannelClose.cs @@ -0,0 +1,96 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ChannelClose : Client.Impl.MethodBase + { + public ushort _replyCode; + public string _replyText; + public ushort _classId; + public ushort _methodId; + + ushort ReplyCode => _replyCode; + string ReplyText => _replyText; + ushort ClassId => _classId; + ushort MethodId => _methodId; + + public ChannelClose() {} + public ChannelClose(ushort @ReplyCode, string @ReplyText, ushort @ClassId, ushort @MethodId) + { + _replyCode = @ReplyCode; + _replyText = @ReplyText; + _classId = @ClassId; + _methodId = @MethodId; + } + + public override ushort ProtocolClassId => ClassConstants.Channel; + public override ushort ProtocolMethodId => ChannelMethodConstants.Close; + public override string ProtocolMethodName => "channel.close"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _replyCode = reader.ReadShort(); + _replyText = reader.ReadShortstr(); + _classId = reader.ReadShort(); + _methodId = reader.ReadShort(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteShort(_replyCode); + writer.WriteShortstr(_replyText); + writer.WriteShort(_classId); + writer.WriteShort(_methodId); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 7; // bytes for _replyCode, length of _replyText, _classId, _methodId + bufferSize += Encoding.UTF8.GetByteCount(_replyText); // _replyText in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_replyCode).Append(','); + sb.Append(_replyText).Append(','); + sb.Append(_classId).Append(','); + sb.Append(_methodId); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ChannelCloseOk.cs b/projects/RabbitMQ.Client/client/framing/ChannelCloseOk.cs new file mode 100644 index 0000000000..ea700e135f --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ChannelCloseOk.cs @@ -0,0 +1,70 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ChannelCloseOk : Client.Impl.MethodBase + { + + + public ChannelCloseOk() + { + } + + public override ushort ProtocolClassId => ClassConstants.Channel; + public override ushort ProtocolMethodId => ChannelMethodConstants.CloseOk; + public override string ProtocolMethodName => "channel.close-ok"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 0; + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ChannelFlow.cs b/projects/RabbitMQ.Client/client/framing/ChannelFlow.cs new file mode 100644 index 0000000000..6745954737 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ChannelFlow.cs @@ -0,0 +1,78 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ChannelFlow : Client.Impl.MethodBase + { + public bool _active; + + bool Active => _active; + + public ChannelFlow() {} + public ChannelFlow(bool @Active) + { + _active = @Active; + } + + public override ushort ProtocolClassId => ClassConstants.Channel; + public override ushort ProtocolMethodId => ChannelMethodConstants.Flow; + public override string ProtocolMethodName => "channel.flow"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _active = reader.ReadBit(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteBit(_active); + writer.EndBits(); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 1; // bytes for bit fields + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_active); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ChannelFlowOk.cs b/projects/RabbitMQ.Client/client/framing/ChannelFlowOk.cs new file mode 100644 index 0000000000..10daf231e0 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ChannelFlowOk.cs @@ -0,0 +1,78 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ChannelFlowOk : Client.Impl.MethodBase + { + public bool _active; + + bool Active => _active; + + public ChannelFlowOk() {} + public ChannelFlowOk(bool @Active) + { + _active = @Active; + } + + public override ushort ProtocolClassId => ClassConstants.Channel; + public override ushort ProtocolMethodId => ChannelMethodConstants.FlowOk; + public override string ProtocolMethodName => "channel.flow-ok"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _active = reader.ReadBit(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteBit(_active); + writer.EndBits(); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 1; // bytes for bit fields + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_active); + sb.Append(')'); + } + } +} diff --git a/projects/Apigen/apigen/AmqpField.cs b/projects/RabbitMQ.Client/client/framing/ChannelMethodConstants.cs similarity index 72% rename from projects/Apigen/apigen/AmqpField.cs rename to projects/RabbitMQ.Client/client/framing/ChannelMethodConstants.cs index e86c6c1b21..b249e9e2b4 100644 --- a/projects/Apigen/apigen/AmqpField.cs +++ b/projects/RabbitMQ.Client/client/framing/ChannelMethodConstants.cs @@ -29,27 +29,15 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Diagnostics; -using System.Xml; - -namespace RabbitMQ.Client.Apigen +namespace RabbitMQ.Client.Framing.Impl { - [DebuggerDisplay("{Domain,nq} {Name,nq}")] - public class AmqpField : AmqpEntity + internal static class ChannelMethodConstants { - public AmqpField(XmlNode n) : base(n) { } - - public string Domain - { - get - { - string result = GetString("@domain", ""); - if (result.Equals("")) - { - result = GetString("@type"); - } - return result; - } - } + internal const ushort Open = 10; + internal const ushort OpenOk = 11; + internal const ushort Flow = 20; + internal const ushort FlowOk = 21; + internal const ushort Close = 40; + internal const ushort CloseOk = 41; } } diff --git a/projects/RabbitMQ.Client/client/framing/ChannelOpen.cs b/projects/RabbitMQ.Client/client/framing/ChannelOpen.cs new file mode 100644 index 0000000000..c1ed42be2e --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ChannelOpen.cs @@ -0,0 +1,78 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ChannelOpen : Client.Impl.MethodBase + { + public string _reserved1; + + string Reserved1 => _reserved1; + + public ChannelOpen() {} + public ChannelOpen(string @Reserved1) + { + _reserved1 = @Reserved1; + } + + public override ushort ProtocolClassId => ClassConstants.Channel; + public override ushort ProtocolMethodId => ChannelMethodConstants.Open; + public override string ProtocolMethodName => "channel.open"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _reserved1 = reader.ReadShortstr(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteShortstr(_reserved1); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 1; // bytes for length of _reserved1 + bufferSize += Encoding.UTF8.GetByteCount(_reserved1); // _reserved1 in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_reserved1); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ChannelOpenOk.cs b/projects/RabbitMQ.Client/client/framing/ChannelOpenOk.cs new file mode 100644 index 0000000000..7053e5122b --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ChannelOpenOk.cs @@ -0,0 +1,78 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ChannelOpenOk : Client.Impl.MethodBase + { + public byte[] _reserved1; + + byte[] Reserved1 => _reserved1; + + public ChannelOpenOk() {} + public ChannelOpenOk(byte[] @Reserved1) + { + _reserved1 = @Reserved1; + } + + public override ushort ProtocolClassId => ClassConstants.Channel; + public override ushort ProtocolMethodId => ChannelMethodConstants.OpenOk; + public override string ProtocolMethodName => "channel.open-ok"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _reserved1 = reader.ReadLongstr(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteLongstr(_reserved1); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 4; // bytes for length of _reserved1 + bufferSize += _reserved1.Length; // _reserved1 in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_reserved1); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ClassConstants.cs b/projects/RabbitMQ.Client/client/framing/ClassConstants.cs new file mode 100644 index 0000000000..af6b612ead --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ClassConstants.cs @@ -0,0 +1,44 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +namespace RabbitMQ.Client.Framing.Impl +{ + internal static class ClassConstants + { + internal const ushort Connection = 10; + internal const ushort Channel = 20; + internal const ushort Exchange = 40; + internal const ushort Queue = 50; + internal const ushort Basic = 60; + internal const ushort Tx = 90; + internal const ushort Confirm = 85; + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ClassId.cs b/projects/RabbitMQ.Client/client/framing/ClassId.cs new file mode 100644 index 0000000000..a29e7aa90c --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ClassId.cs @@ -0,0 +1,45 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +namespace RabbitMQ.Client.Framing.Impl +{ + internal enum ClassId + { + Connection = 10, + Channel = 20, + Exchange = 40, + Queue = 50, + Basic = 60, + Tx = 90, + Confirm = 85, + Invalid = -1, + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ConfirmMethodConstants.cs b/projects/RabbitMQ.Client/client/framing/ConfirmMethodConstants.cs new file mode 100644 index 0000000000..26af360347 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ConfirmMethodConstants.cs @@ -0,0 +1,39 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +namespace RabbitMQ.Client.Framing.Impl +{ + internal static class ConfirmMethodConstants + { + internal const ushort Select = 10; + internal const ushort SelectOk = 11; + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ConfirmSelect.cs b/projects/RabbitMQ.Client/client/framing/ConfirmSelect.cs new file mode 100644 index 0000000000..44ec954509 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ConfirmSelect.cs @@ -0,0 +1,78 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ConfirmSelect : Client.Impl.MethodBase + { + public bool _nowait; + + bool Nowait => _nowait; + + public ConfirmSelect() {} + public ConfirmSelect(bool @Nowait) + { + _nowait = @Nowait; + } + + public override ushort ProtocolClassId => ClassConstants.Confirm; + public override ushort ProtocolMethodId => ConfirmMethodConstants.Select; + public override string ProtocolMethodName => "confirm.select"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _nowait = reader.ReadBit(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteBit(_nowait); + writer.EndBits(); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 1; // bytes for bit fields + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_nowait); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ConfirmSelectOk.cs b/projects/RabbitMQ.Client/client/framing/ConfirmSelectOk.cs new file mode 100644 index 0000000000..b88298c6dd --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ConfirmSelectOk.cs @@ -0,0 +1,70 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ConfirmSelectOk : Client.Impl.MethodBase + { + + + public ConfirmSelectOk() + { + } + + public override ushort ProtocolClassId => ClassConstants.Confirm; + public override ushort ProtocolMethodId => ConfirmMethodConstants.SelectOk; + public override string ProtocolMethodName => "confirm.select-ok"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 0; + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionBlocked.cs b/projects/RabbitMQ.Client/client/framing/ConnectionBlocked.cs new file mode 100644 index 0000000000..7322fb8113 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ConnectionBlocked.cs @@ -0,0 +1,78 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ConnectionBlocked : Client.Impl.MethodBase + { + public string _reason; + + string Reason => _reason; + + public ConnectionBlocked() {} + public ConnectionBlocked(string @Reason) + { + _reason = @Reason; + } + + public override ushort ProtocolClassId => ClassConstants.Connection; + public override ushort ProtocolMethodId => ConnectionMethodConstants.Blocked; + public override string ProtocolMethodName => "connection.blocked"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _reason = reader.ReadShortstr(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteShortstr(_reason); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 1; // bytes for length of _reason + bufferSize += Encoding.UTF8.GetByteCount(_reason); // _reason in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_reason); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionClose.cs b/projects/RabbitMQ.Client/client/framing/ConnectionClose.cs new file mode 100644 index 0000000000..24238c3105 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ConnectionClose.cs @@ -0,0 +1,96 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ConnectionClose : Client.Impl.MethodBase + { + public ushort _replyCode; + public string _replyText; + public ushort _classId; + public ushort _methodId; + + ushort ReplyCode => _replyCode; + string ReplyText => _replyText; + ushort ClassId => _classId; + ushort MethodId => _methodId; + + public ConnectionClose() {} + public ConnectionClose(ushort @ReplyCode, string @ReplyText, ushort @ClassId, ushort @MethodId) + { + _replyCode = @ReplyCode; + _replyText = @ReplyText; + _classId = @ClassId; + _methodId = @MethodId; + } + + public override ushort ProtocolClassId => ClassConstants.Connection; + public override ushort ProtocolMethodId => ConnectionMethodConstants.Close; + public override string ProtocolMethodName => "connection.close"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _replyCode = reader.ReadShort(); + _replyText = reader.ReadShortstr(); + _classId = reader.ReadShort(); + _methodId = reader.ReadShort(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteShort(_replyCode); + writer.WriteShortstr(_replyText); + writer.WriteShort(_classId); + writer.WriteShort(_methodId); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 7; // bytes for _replyCode, length of _replyText, _classId, _methodId + bufferSize += Encoding.UTF8.GetByteCount(_replyText); // _replyText in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_replyCode).Append(','); + sb.Append(_replyText).Append(','); + sb.Append(_classId).Append(','); + sb.Append(_methodId); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionCloseOk.cs b/projects/RabbitMQ.Client/client/framing/ConnectionCloseOk.cs new file mode 100644 index 0000000000..32617b1780 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ConnectionCloseOk.cs @@ -0,0 +1,70 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ConnectionCloseOk : Client.Impl.MethodBase + { + + + public ConnectionCloseOk() + { + } + + public override ushort ProtocolClassId => ClassConstants.Connection; + public override ushort ProtocolMethodId => ConnectionMethodConstants.CloseOk; + public override string ProtocolMethodName => "connection.close-ok"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 0; + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionMethodConstants.cs b/projects/RabbitMQ.Client/client/framing/ConnectionMethodConstants.cs new file mode 100644 index 0000000000..6ec63cf72b --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ConnectionMethodConstants.cs @@ -0,0 +1,51 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +namespace RabbitMQ.Client.Framing.Impl +{ + internal static class ConnectionMethodConstants + { + internal const ushort Start = 10; + internal const ushort StartOk = 11; + internal const ushort Secure = 20; + internal const ushort SecureOk = 21; + internal const ushort Tune = 30; + internal const ushort TuneOk = 31; + internal const ushort Open = 40; + internal const ushort OpenOk = 41; + internal const ushort Close = 50; + internal const ushort CloseOk = 51; + internal const ushort Blocked = 60; + internal const ushort Unblocked = 61; + internal const ushort UpdateSecret = 70; + internal const ushort UpdateSecretOk = 71; + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionOpen.cs b/projects/RabbitMQ.Client/client/framing/ConnectionOpen.cs new file mode 100644 index 0000000000..acc6434d33 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ConnectionOpen.cs @@ -0,0 +1,92 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ConnectionOpen : Client.Impl.MethodBase + { + public string _virtualHost; + public string _reserved1; + public bool _reserved2; + + string VirtualHost => _virtualHost; + string Reserved1 => _reserved1; + bool Reserved2 => _reserved2; + + public ConnectionOpen() {} + public ConnectionOpen(string @VirtualHost, string @Reserved1, bool @Reserved2) + { + _virtualHost = @VirtualHost; + _reserved1 = @Reserved1; + _reserved2 = @Reserved2; + } + + public override ushort ProtocolClassId => ClassConstants.Connection; + public override ushort ProtocolMethodId => ConnectionMethodConstants.Open; + public override string ProtocolMethodName => "connection.open"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _virtualHost = reader.ReadShortstr(); + _reserved1 = reader.ReadShortstr(); + _reserved2 = reader.ReadBit(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteShortstr(_virtualHost); + writer.WriteShortstr(_reserved1); + writer.WriteBit(_reserved2); + writer.EndBits(); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 3; // bytes for length of _virtualHost, length of _reserved1, bit fields + bufferSize += Encoding.UTF8.GetByteCount(_virtualHost); // _virtualHost in bytes + bufferSize += Encoding.UTF8.GetByteCount(_reserved1); // _reserved1 in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_virtualHost).Append(','); + sb.Append(_reserved1).Append(','); + sb.Append(_reserved2); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionOpenOk.cs b/projects/RabbitMQ.Client/client/framing/ConnectionOpenOk.cs new file mode 100644 index 0000000000..c223b109d9 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ConnectionOpenOk.cs @@ -0,0 +1,78 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ConnectionOpenOk : Client.Impl.MethodBase + { + public string _reserved1; + + string Reserved1 => _reserved1; + + public ConnectionOpenOk() {} + public ConnectionOpenOk(string @Reserved1) + { + _reserved1 = @Reserved1; + } + + public override ushort ProtocolClassId => ClassConstants.Connection; + public override ushort ProtocolMethodId => ConnectionMethodConstants.OpenOk; + public override string ProtocolMethodName => "connection.open-ok"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _reserved1 = reader.ReadShortstr(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteShortstr(_reserved1); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 1; // bytes for length of _reserved1 + bufferSize += Encoding.UTF8.GetByteCount(_reserved1); // _reserved1 in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_reserved1); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionSecure.cs b/projects/RabbitMQ.Client/client/framing/ConnectionSecure.cs new file mode 100644 index 0000000000..0b7f69095a --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ConnectionSecure.cs @@ -0,0 +1,78 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ConnectionSecure : Client.Impl.MethodBase + { + public byte[] _challenge; + + byte[] Challenge => _challenge; + + public ConnectionSecure() {} + public ConnectionSecure(byte[] @Challenge) + { + _challenge = @Challenge; + } + + public override ushort ProtocolClassId => ClassConstants.Connection; + public override ushort ProtocolMethodId => ConnectionMethodConstants.Secure; + public override string ProtocolMethodName => "connection.secure"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _challenge = reader.ReadLongstr(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteLongstr(_challenge); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 4; // bytes for length of _challenge + bufferSize += _challenge.Length; // _challenge in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_challenge); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionSecureOk.cs b/projects/RabbitMQ.Client/client/framing/ConnectionSecureOk.cs new file mode 100644 index 0000000000..3f5e1fc4d8 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ConnectionSecureOk.cs @@ -0,0 +1,78 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ConnectionSecureOk : Client.Impl.MethodBase + { + public byte[] _response; + + byte[] Response => _response; + + public ConnectionSecureOk() {} + public ConnectionSecureOk(byte[] @Response) + { + _response = @Response; + } + + public override ushort ProtocolClassId => ClassConstants.Connection; + public override ushort ProtocolMethodId => ConnectionMethodConstants.SecureOk; + public override string ProtocolMethodName => "connection.secure-ok"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _response = reader.ReadLongstr(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteLongstr(_response); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 4; // bytes for length of _response + bufferSize += _response.Length; // _response in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_response); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionStart.cs b/projects/RabbitMQ.Client/client/framing/ConnectionStart.cs new file mode 100644 index 0000000000..88da644b0b --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ConnectionStart.cs @@ -0,0 +1,106 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Collections.Generic; +using System.Text; +using RabbitMQ.Client.Impl; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ConnectionStart : Client.Impl.MethodBase + { + public byte _versionMajor; + public byte _versionMinor; + public IDictionary _serverProperties; + public byte[] _mechanisms; + public byte[] _locales; + + byte VersionMajor => _versionMajor; + byte VersionMinor => _versionMinor; + IDictionary ServerProperties => _serverProperties; + byte[] Mechanisms => _mechanisms; + byte[] Locales => _locales; + + public ConnectionStart() {} + public ConnectionStart(byte @VersionMajor, byte @VersionMinor, IDictionary @ServerProperties, byte[] @Mechanisms, byte[] @Locales) + { + _versionMajor = @VersionMajor; + _versionMinor = @VersionMinor; + _serverProperties = @ServerProperties; + _mechanisms = @Mechanisms; + _locales = @Locales; + } + + public override ushort ProtocolClassId => ClassConstants.Connection; + public override ushort ProtocolMethodId => ConnectionMethodConstants.Start; + public override string ProtocolMethodName => "connection.start"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _versionMajor = reader.ReadOctet(); + _versionMinor = reader.ReadOctet(); + _serverProperties = reader.ReadTable(); + _mechanisms = reader.ReadLongstr(); + _locales = reader.ReadLongstr(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteOctet(_versionMajor); + writer.WriteOctet(_versionMinor); + writer.WriteTable(_serverProperties); + writer.WriteLongstr(_mechanisms); + writer.WriteLongstr(_locales); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 10; // bytes for _versionMajor, _versionMinor, length of _mechanisms, length of _locales + bufferSize += WireFormatting.GetTableByteCount(_serverProperties); // _serverProperties in bytes + bufferSize += _mechanisms.Length; // _mechanisms in bytes + bufferSize += _locales.Length; // _locales in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_versionMajor).Append(','); + sb.Append(_versionMinor).Append(','); + sb.Append(_serverProperties).Append(','); + sb.Append(_mechanisms).Append(','); + sb.Append(_locales); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionStartOk.cs b/projects/RabbitMQ.Client/client/framing/ConnectionStartOk.cs new file mode 100644 index 0000000000..ec385ed58e --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ConnectionStartOk.cs @@ -0,0 +1,101 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Collections.Generic; +using System.Text; +using RabbitMQ.Client.Impl; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ConnectionStartOk : Client.Impl.MethodBase + { + public IDictionary _clientProperties; + public string _mechanism; + public byte[] _response; + public string _locale; + + IDictionary ClientProperties => _clientProperties; + string Mechanism => _mechanism; + byte[] Response => _response; + string Locale => _locale; + + public ConnectionStartOk() {} + public ConnectionStartOk(IDictionary @ClientProperties, string @Mechanism, byte[] @Response, string @Locale) + { + _clientProperties = @ClientProperties; + _mechanism = @Mechanism; + _response = @Response; + _locale = @Locale; + } + + public override ushort ProtocolClassId => ClassConstants.Connection; + public override ushort ProtocolMethodId => ConnectionMethodConstants.StartOk; + public override string ProtocolMethodName => "connection.start-ok"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _clientProperties = reader.ReadTable(); + _mechanism = reader.ReadShortstr(); + _response = reader.ReadLongstr(); + _locale = reader.ReadShortstr(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteTable(_clientProperties); + writer.WriteShortstr(_mechanism); + writer.WriteLongstr(_response); + writer.WriteShortstr(_locale); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 6; // bytes for length of _mechanism, length of _response, length of _locale + bufferSize += WireFormatting.GetTableByteCount(_clientProperties); // _clientProperties in bytes + bufferSize += Encoding.UTF8.GetByteCount(_mechanism); // _mechanism in bytes + bufferSize += _response.Length; // _response in bytes + bufferSize += Encoding.UTF8.GetByteCount(_locale); // _locale in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_clientProperties).Append(','); + sb.Append(_mechanism).Append(','); + sb.Append(_response).Append(','); + sb.Append(_locale); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionTune.cs b/projects/RabbitMQ.Client/client/framing/ConnectionTune.cs new file mode 100644 index 0000000000..2c70fca6fc --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ConnectionTune.cs @@ -0,0 +1,89 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ConnectionTune : Client.Impl.MethodBase + { + public ushort _channelMax; + public uint _frameMax; + public ushort _heartbeat; + + ushort ChannelMax => _channelMax; + uint FrameMax => _frameMax; + ushort Heartbeat => _heartbeat; + + public ConnectionTune() {} + public ConnectionTune(ushort @ChannelMax, uint @FrameMax, ushort @Heartbeat) + { + _channelMax = @ChannelMax; + _frameMax = @FrameMax; + _heartbeat = @Heartbeat; + } + + public override ushort ProtocolClassId => ClassConstants.Connection; + public override ushort ProtocolMethodId => ConnectionMethodConstants.Tune; + public override string ProtocolMethodName => "connection.tune"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _channelMax = reader.ReadShort(); + _frameMax = reader.ReadLong(); + _heartbeat = reader.ReadShort(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteShort(_channelMax); + writer.WriteLong(_frameMax); + writer.WriteShort(_heartbeat); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 8; // bytes for _channelMax, _frameMax, _heartbeat + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_channelMax).Append(','); + sb.Append(_frameMax).Append(','); + sb.Append(_heartbeat); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionTuneOk.cs b/projects/RabbitMQ.Client/client/framing/ConnectionTuneOk.cs new file mode 100644 index 0000000000..521e1fc922 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ConnectionTuneOk.cs @@ -0,0 +1,89 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ConnectionTuneOk : Client.Impl.MethodBase + { + public ushort _channelMax; + public uint _frameMax; + public ushort _heartbeat; + + ushort ChannelMax => _channelMax; + uint FrameMax => _frameMax; + ushort Heartbeat => _heartbeat; + + public ConnectionTuneOk() {} + public ConnectionTuneOk(ushort @ChannelMax, uint @FrameMax, ushort @Heartbeat) + { + _channelMax = @ChannelMax; + _frameMax = @FrameMax; + _heartbeat = @Heartbeat; + } + + public override ushort ProtocolClassId => ClassConstants.Connection; + public override ushort ProtocolMethodId => ConnectionMethodConstants.TuneOk; + public override string ProtocolMethodName => "connection.tune-ok"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _channelMax = reader.ReadShort(); + _frameMax = reader.ReadLong(); + _heartbeat = reader.ReadShort(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteShort(_channelMax); + writer.WriteLong(_frameMax); + writer.WriteShort(_heartbeat); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 8; // bytes for _channelMax, _frameMax, _heartbeat + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_channelMax).Append(','); + sb.Append(_frameMax).Append(','); + sb.Append(_heartbeat); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionUnblocked.cs b/projects/RabbitMQ.Client/client/framing/ConnectionUnblocked.cs new file mode 100644 index 0000000000..a45a03fe6c --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ConnectionUnblocked.cs @@ -0,0 +1,70 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ConnectionUnblocked : Client.Impl.MethodBase + { + + + public ConnectionUnblocked() + { + } + + public override ushort ProtocolClassId => ClassConstants.Connection; + public override ushort ProtocolMethodId => ConnectionMethodConstants.Unblocked; + public override string ProtocolMethodName => "connection.unblocked"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 0; + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionUpdateSecret.cs b/projects/RabbitMQ.Client/client/framing/ConnectionUpdateSecret.cs new file mode 100644 index 0000000000..c954b5c2f1 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ConnectionUpdateSecret.cs @@ -0,0 +1,85 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ConnectionUpdateSecret : Client.Impl.MethodBase + { + public byte[] _newSecret; + public string _reason; + + byte[] NewSecret => _newSecret; + string Reason => _reason; + + public ConnectionUpdateSecret() {} + public ConnectionUpdateSecret(byte[] @NewSecret, string @Reason) + { + _newSecret = @NewSecret; + _reason = @Reason; + } + + public override ushort ProtocolClassId => ClassConstants.Connection; + public override ushort ProtocolMethodId => ConnectionMethodConstants.UpdateSecret; + public override string ProtocolMethodName => "connection.update-secret"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _newSecret = reader.ReadLongstr(); + _reason = reader.ReadShortstr(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteLongstr(_newSecret); + writer.WriteShortstr(_reason); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 5; // bytes for length of _newSecret, length of _reason + bufferSize += _newSecret.Length; // _newSecret in bytes + bufferSize += Encoding.UTF8.GetByteCount(_reason); // _reason in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_newSecret).Append(','); + sb.Append(_reason); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionUpdateSecretOk.cs b/projects/RabbitMQ.Client/client/framing/ConnectionUpdateSecretOk.cs new file mode 100644 index 0000000000..4d4226ef0f --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ConnectionUpdateSecretOk.cs @@ -0,0 +1,70 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ConnectionUpdateSecretOk : Client.Impl.MethodBase + { + + + public ConnectionUpdateSecretOk() + { + } + + public override ushort ProtocolClassId => ClassConstants.Connection; + public override ushort ProtocolMethodId => ConnectionMethodConstants.UpdateSecretOk; + public override string ProtocolMethodName => "connection.update-secret-ok"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 0; + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/Constants.cs b/projects/RabbitMQ.Client/client/framing/Constants.cs new file mode 100644 index 0000000000..5d75f698f6 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/Constants.cs @@ -0,0 +1,85 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +namespace RabbitMQ.Client +{ + public static class Constants + { + ///(= 1) + public const int FrameMethod = 1; + ///(= 2) + public const int FrameHeader = 2; + ///(= 3) + public const int FrameBody = 3; + ///(= 8) + public const int FrameHeartbeat = 8; + ///(= 4096) + public const int FrameMinSize = 4096; + ///(= 206) + public const int FrameEnd = 206; + ///(= 200) + public const int ReplySuccess = 200; + ///(= 311) + public const int ContentTooLarge = 311; + ///(= 313) + public const int NoConsumers = 313; + ///(= 320) + public const int ConnectionForced = 320; + ///(= 402) + public const int InvalidPath = 402; + ///(= 403) + public const int AccessRefused = 403; + ///(= 404) + public const int NotFound = 404; + ///(= 405) + public const int ResourceLocked = 405; + ///(= 406) + public const int PreconditionFailed = 406; + ///(= 501) + public const int FrameError = 501; + ///(= 502) + public const int SyntaxError = 502; + ///(= 503) + public const int CommandInvalid = 503; + ///(= 504) + public const int ChannelError = 504; + ///(= 505) + public const int UnexpectedFrame = 505; + ///(= 506) + public const int ResourceError = 506; + ///(= 530) + public const int NotAllowed = 530; + ///(= 540) + public const int NotImplemented = 540; + ///(= 541) + public const int InternalError = 541; + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ExchangeBind.cs b/projects/RabbitMQ.Client/client/framing/ExchangeBind.cs new file mode 100644 index 0000000000..f88e68c33c --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ExchangeBind.cs @@ -0,0 +1,114 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Collections.Generic; +using System.Text; +using RabbitMQ.Client.Impl; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ExchangeBind : Client.Impl.MethodBase + { + public ushort _reserved1; + public string _destination; + public string _source; + public string _routingKey; + public bool _nowait; + public IDictionary _arguments; + + ushort Reserved1 => _reserved1; + string Destination => _destination; + string Source => _source; + string RoutingKey => _routingKey; + bool Nowait => _nowait; + IDictionary Arguments => _arguments; + + public ExchangeBind() {} + public ExchangeBind(ushort @Reserved1, string @Destination, string @Source, string @RoutingKey, bool @Nowait, IDictionary @Arguments) + { + _reserved1 = @Reserved1; + _destination = @Destination; + _source = @Source; + _routingKey = @RoutingKey; + _nowait = @Nowait; + _arguments = @Arguments; + } + + public override ushort ProtocolClassId => ClassConstants.Exchange; + public override ushort ProtocolMethodId => ExchangeMethodConstants.Bind; + public override string ProtocolMethodName => "exchange.bind"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _reserved1 = reader.ReadShort(); + _destination = reader.ReadShortstr(); + _source = reader.ReadShortstr(); + _routingKey = reader.ReadShortstr(); + _nowait = reader.ReadBit(); + _arguments = reader.ReadTable(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteShort(_reserved1); + writer.WriteShortstr(_destination); + writer.WriteShortstr(_source); + writer.WriteShortstr(_routingKey); + writer.WriteBit(_nowait); + writer.EndBits(); + writer.WriteTable(_arguments); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 6; // bytes for _reserved1, length of _destination, length of _source, length of _routingKey, bit fields + bufferSize += Encoding.UTF8.GetByteCount(_destination); // _destination in bytes + bufferSize += Encoding.UTF8.GetByteCount(_source); // _source in bytes + bufferSize += Encoding.UTF8.GetByteCount(_routingKey); // _routingKey in bytes + bufferSize += WireFormatting.GetTableByteCount(_arguments); // _arguments in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_reserved1).Append(','); + sb.Append(_destination).Append(','); + sb.Append(_source).Append(','); + sb.Append(_routingKey).Append(','); + sb.Append(_nowait).Append(','); + sb.Append(_arguments); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ExchangeBindOk.cs b/projects/RabbitMQ.Client/client/framing/ExchangeBindOk.cs new file mode 100644 index 0000000000..7b76834b44 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ExchangeBindOk.cs @@ -0,0 +1,70 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ExchangeBindOk : Client.Impl.MethodBase + { + + + public ExchangeBindOk() + { + } + + public override ushort ProtocolClassId => ClassConstants.Exchange; + public override ushort ProtocolMethodId => ExchangeMethodConstants.BindOk; + public override string ProtocolMethodName => "exchange.bind-ok"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 0; + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ExchangeDeclare.cs b/projects/RabbitMQ.Client/client/framing/ExchangeDeclare.cs new file mode 100644 index 0000000000..4ad8eac299 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ExchangeDeclare.cs @@ -0,0 +1,131 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Collections.Generic; +using System.Text; +using RabbitMQ.Client.Impl; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ExchangeDeclare : Client.Impl.MethodBase + { + public ushort _reserved1; + public string _exchange; + public string _type; + public bool _passive; + public bool _durable; + public bool _autoDelete; + public bool _internal; + public bool _nowait; + public IDictionary _arguments; + + ushort Reserved1 => _reserved1; + string Exchange => _exchange; + string Type => _type; + bool Passive => _passive; + bool Durable => _durable; + bool AutoDelete => _autoDelete; + bool Internal => _internal; + bool Nowait => _nowait; + IDictionary Arguments => _arguments; + + public ExchangeDeclare() {} + public ExchangeDeclare(ushort @Reserved1, string @Exchange, string @Type, bool @Passive, bool @Durable, bool @AutoDelete, bool @Internal, bool @Nowait, IDictionary @Arguments) + { + _reserved1 = @Reserved1; + _exchange = @Exchange; + _type = @Type; + _passive = @Passive; + _durable = @Durable; + _autoDelete = @AutoDelete; + _internal = @Internal; + _nowait = @Nowait; + _arguments = @Arguments; + } + + public override ushort ProtocolClassId => ClassConstants.Exchange; + public override ushort ProtocolMethodId => ExchangeMethodConstants.Declare; + public override string ProtocolMethodName => "exchange.declare"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _reserved1 = reader.ReadShort(); + _exchange = reader.ReadShortstr(); + _type = reader.ReadShortstr(); + _passive = reader.ReadBit(); + _durable = reader.ReadBit(); + _autoDelete = reader.ReadBit(); + _internal = reader.ReadBit(); + _nowait = reader.ReadBit(); + _arguments = reader.ReadTable(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteShort(_reserved1); + writer.WriteShortstr(_exchange); + writer.WriteShortstr(_type); + writer.WriteBit(_passive); + writer.WriteBit(_durable); + writer.WriteBit(_autoDelete); + writer.WriteBit(_internal); + writer.WriteBit(_nowait); + writer.EndBits(); + writer.WriteTable(_arguments); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 5; // bytes for _reserved1, length of _exchange, length of _type, bit fields + bufferSize += Encoding.UTF8.GetByteCount(_exchange); // _exchange in bytes + bufferSize += Encoding.UTF8.GetByteCount(_type); // _type in bytes + bufferSize += WireFormatting.GetTableByteCount(_arguments); // _arguments in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_reserved1).Append(','); + sb.Append(_exchange).Append(','); + sb.Append(_type).Append(','); + sb.Append(_passive).Append(','); + sb.Append(_durable).Append(','); + sb.Append(_autoDelete).Append(','); + sb.Append(_internal).Append(','); + sb.Append(_nowait).Append(','); + sb.Append(_arguments); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ExchangeDeclareOk.cs b/projects/RabbitMQ.Client/client/framing/ExchangeDeclareOk.cs new file mode 100644 index 0000000000..2754b68a55 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ExchangeDeclareOk.cs @@ -0,0 +1,70 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ExchangeDeclareOk : Client.Impl.MethodBase + { + + + public ExchangeDeclareOk() + { + } + + public override ushort ProtocolClassId => ClassConstants.Exchange; + public override ushort ProtocolMethodId => ExchangeMethodConstants.DeclareOk; + public override string ProtocolMethodName => "exchange.declare-ok"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 0; + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ExchangeDelete.cs b/projects/RabbitMQ.Client/client/framing/ExchangeDelete.cs new file mode 100644 index 0000000000..a546b1099f --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ExchangeDelete.cs @@ -0,0 +1,97 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ExchangeDelete : Client.Impl.MethodBase + { + public ushort _reserved1; + public string _exchange; + public bool _ifUnused; + public bool _nowait; + + ushort Reserved1 => _reserved1; + string Exchange => _exchange; + bool IfUnused => _ifUnused; + bool Nowait => _nowait; + + public ExchangeDelete() {} + public ExchangeDelete(ushort @Reserved1, string @Exchange, bool @IfUnused, bool @Nowait) + { + _reserved1 = @Reserved1; + _exchange = @Exchange; + _ifUnused = @IfUnused; + _nowait = @Nowait; + } + + public override ushort ProtocolClassId => ClassConstants.Exchange; + public override ushort ProtocolMethodId => ExchangeMethodConstants.Delete; + public override string ProtocolMethodName => "exchange.delete"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _reserved1 = reader.ReadShort(); + _exchange = reader.ReadShortstr(); + _ifUnused = reader.ReadBit(); + _nowait = reader.ReadBit(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteShort(_reserved1); + writer.WriteShortstr(_exchange); + writer.WriteBit(_ifUnused); + writer.WriteBit(_nowait); + writer.EndBits(); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 4; // bytes for _reserved1, length of _exchange, bit fields + bufferSize += Encoding.UTF8.GetByteCount(_exchange); // _exchange in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_reserved1).Append(','); + sb.Append(_exchange).Append(','); + sb.Append(_ifUnused).Append(','); + sb.Append(_nowait); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ExchangeDeleteOk.cs b/projects/RabbitMQ.Client/client/framing/ExchangeDeleteOk.cs new file mode 100644 index 0000000000..34ecc40af8 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ExchangeDeleteOk.cs @@ -0,0 +1,70 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ExchangeDeleteOk : Client.Impl.MethodBase + { + + + public ExchangeDeleteOk() + { + } + + public override ushort ProtocolClassId => ClassConstants.Exchange; + public override ushort ProtocolMethodId => ExchangeMethodConstants.DeleteOk; + public override string ProtocolMethodName => "exchange.delete-ok"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 0; + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ExchangeMethodConstants.cs b/projects/RabbitMQ.Client/client/framing/ExchangeMethodConstants.cs new file mode 100644 index 0000000000..eb056cd632 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ExchangeMethodConstants.cs @@ -0,0 +1,45 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +namespace RabbitMQ.Client.Framing.Impl +{ + internal static class ExchangeMethodConstants + { + internal const ushort Declare = 10; + internal const ushort DeclareOk = 11; + internal const ushort Delete = 20; + internal const ushort DeleteOk = 21; + internal const ushort Bind = 30; + internal const ushort BindOk = 31; + internal const ushort Unbind = 40; + internal const ushort UnbindOk = 51; + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ExchangeUnbind.cs b/projects/RabbitMQ.Client/client/framing/ExchangeUnbind.cs new file mode 100644 index 0000000000..bea3df94bd --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ExchangeUnbind.cs @@ -0,0 +1,114 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Collections.Generic; +using System.Text; +using RabbitMQ.Client.Impl; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ExchangeUnbind : Client.Impl.MethodBase + { + public ushort _reserved1; + public string _destination; + public string _source; + public string _routingKey; + public bool _nowait; + public IDictionary _arguments; + + ushort Reserved1 => _reserved1; + string Destination => _destination; + string Source => _source; + string RoutingKey => _routingKey; + bool Nowait => _nowait; + IDictionary Arguments => _arguments; + + public ExchangeUnbind() {} + public ExchangeUnbind(ushort @Reserved1, string @Destination, string @Source, string @RoutingKey, bool @Nowait, IDictionary @Arguments) + { + _reserved1 = @Reserved1; + _destination = @Destination; + _source = @Source; + _routingKey = @RoutingKey; + _nowait = @Nowait; + _arguments = @Arguments; + } + + public override ushort ProtocolClassId => ClassConstants.Exchange; + public override ushort ProtocolMethodId => ExchangeMethodConstants.Unbind; + public override string ProtocolMethodName => "exchange.unbind"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _reserved1 = reader.ReadShort(); + _destination = reader.ReadShortstr(); + _source = reader.ReadShortstr(); + _routingKey = reader.ReadShortstr(); + _nowait = reader.ReadBit(); + _arguments = reader.ReadTable(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteShort(_reserved1); + writer.WriteShortstr(_destination); + writer.WriteShortstr(_source); + writer.WriteShortstr(_routingKey); + writer.WriteBit(_nowait); + writer.EndBits(); + writer.WriteTable(_arguments); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 6; // bytes for _reserved1, length of _destination, length of _source, length of _routingKey, bit fields + bufferSize += Encoding.UTF8.GetByteCount(_destination); // _destination in bytes + bufferSize += Encoding.UTF8.GetByteCount(_source); // _source in bytes + bufferSize += Encoding.UTF8.GetByteCount(_routingKey); // _routingKey in bytes + bufferSize += WireFormatting.GetTableByteCount(_arguments); // _arguments in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_reserved1).Append(','); + sb.Append(_destination).Append(','); + sb.Append(_source).Append(','); + sb.Append(_routingKey).Append(','); + sb.Append(_nowait).Append(','); + sb.Append(_arguments); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/ExchangeUnbindOk.cs b/projects/RabbitMQ.Client/client/framing/ExchangeUnbindOk.cs new file mode 100644 index 0000000000..8e71c8b7d2 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/ExchangeUnbindOk.cs @@ -0,0 +1,70 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class ExchangeUnbindOk : Client.Impl.MethodBase + { + + + public ExchangeUnbindOk() + { + } + + public override ushort ProtocolClassId => ClassConstants.Exchange; + public override ushort ProtocolMethodId => ExchangeMethodConstants.UnbindOk; + public override string ProtocolMethodName => "exchange.unbind-ok"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 0; + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/Model.cs b/projects/RabbitMQ.Client/client/framing/Model.cs new file mode 100644 index 0000000000..0aa4d05f7f --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/Model.cs @@ -0,0 +1,599 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using RabbitMQ.Client.Exceptions; +using RabbitMQ.Client.Impl; + +namespace RabbitMQ.Client.Framing.Impl +{ + internal class Model: Client.Impl.ModelBase + { + public Model(Client.Impl.ISession session): base(session) {} + public Model(Client.Impl.ISession session, ConsumerWorkService workService): base(session, workService) {} + public override void ConnectionTuneOk (ushort @channelMax, uint @frameMax, ushort @heartbeat) + { + ConnectionTuneOk __req = new ConnectionTuneOk() + { + _channelMax = @channelMax, + _frameMax = @frameMax, + _heartbeat = @heartbeat, + }; + ModelSend(__req,null,null); + } + public override void _Private_BasicCancel (string @consumerTag, bool @nowait) + { + BasicCancel __req = new BasicCancel() + { + _consumerTag = @consumerTag, + _nowait = @nowait, + }; + ModelSend(__req,null,null); + } + public override void _Private_BasicConsume (string @queue, string @consumerTag, bool @noLocal, bool @autoAck, bool @exclusive, bool @nowait, IDictionary @arguments) + { + BasicConsume __req = new BasicConsume() + { + _queue = @queue, + _consumerTag = @consumerTag, + _noLocal = @noLocal, + _noAck = @autoAck, + _exclusive = @exclusive, + _nowait = @nowait, + _arguments = @arguments, + }; + ModelSend(__req,null,null); + } + public override void _Private_BasicGet (string @queue, bool @autoAck) + { + BasicGet __req = new BasicGet() + { + _queue = @queue, + _noAck = @autoAck, + }; + ModelSend(__req,null,null); + } + public override void _Private_BasicPublish (string @exchange, string @routingKey, bool @mandatory, RabbitMQ.Client.IBasicProperties @basicProperties, ReadOnlyMemory @body) + { + BasicPublish __req = new BasicPublish() + { + _exchange = @exchange, + _routingKey = @routingKey, + _mandatory = @mandatory, + }; + ModelSend(__req, (BasicProperties) basicProperties,body); + } + public override void _Private_BasicRecover (bool @requeue) + { + BasicRecover __req = new BasicRecover() + { + _requeue = @requeue, + }; + ModelSend(__req,null,null); + } + public override void _Private_ChannelClose (ushort @replyCode, string @replyText, ushort @classId, ushort @methodId) + { + ChannelClose __req = new ChannelClose() + { + _replyCode = @replyCode, + _replyText = @replyText, + _classId = @classId, + _methodId = @methodId, + }; + ModelSend(__req,null,null); + } + public override void _Private_ChannelCloseOk () + { + ChannelCloseOk __req = new ChannelCloseOk(); + ModelSend(__req,null,null); + } + public override void _Private_ChannelFlowOk (bool @active) + { + ChannelFlowOk __req = new ChannelFlowOk() + { + _active = @active, + }; + ModelSend(__req,null,null); + } + public override void _Private_ChannelOpen (string @outOfBand) + { + ChannelOpen __req = new ChannelOpen() + { + _reserved1 = @outOfBand, + }; + Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); + if (!(__repBase is ChannelOpenOk)) + { + throw new UnexpectedMethodException(__repBase); + } + } + public override void _Private_ConfirmSelect (bool @nowait) + { + ConfirmSelect __req = new ConfirmSelect() + { + _nowait = @nowait, + }; + if (nowait) { + ModelSend(__req,null,null); + return; + } + Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); + if (!(__repBase is ConfirmSelectOk)) + { + throw new UnexpectedMethodException(__repBase); + } + } + public override void _Private_ConnectionClose (ushort @replyCode, string @replyText, ushort @classId, ushort @methodId) + { + ConnectionClose __req = new ConnectionClose() + { + _replyCode = @replyCode, + _replyText = @replyText, + _classId = @classId, + _methodId = @methodId, + }; + Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); + if (!(__repBase is ConnectionCloseOk)) + { + throw new UnexpectedMethodException(__repBase); + } + } + public override void _Private_ConnectionCloseOk () + { + ConnectionCloseOk __req = new ConnectionCloseOk(); + ModelSend(__req,null,null); + } + public override void _Private_ConnectionOpen (string @virtualHost, string @capabilities, bool @insist) + { + ConnectionOpen __req = new ConnectionOpen() + { + _virtualHost = @virtualHost, + _reserved1 = @capabilities, + _reserved2 = @insist, + }; + ModelSend(__req,null,null); + } + public override void _Private_ConnectionSecureOk (byte[] @response) + { + ConnectionSecureOk __req = new ConnectionSecureOk() + { + _response = @response, + }; + ModelSend(__req,null,null); + } + public override void _Private_ConnectionStartOk (IDictionary @clientProperties, string @mechanism, byte[] @response, string @locale) + { + ConnectionStartOk __req = new ConnectionStartOk() + { + _clientProperties = @clientProperties, + _mechanism = @mechanism, + _response = @response, + _locale = @locale, + }; + ModelSend(__req,null,null); + } + public override void _Private_UpdateSecret (byte[] @newSecret, string @reason) + { + ConnectionUpdateSecret __req = new ConnectionUpdateSecret() + { + _newSecret = @newSecret, + _reason = @reason, + }; + Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); + if (!(__repBase is ConnectionUpdateSecretOk)) + { + throw new UnexpectedMethodException(__repBase); + } + } + public override void _Private_ExchangeBind (string @destination, string @source, string @routingKey, bool @nowait, IDictionary @arguments) + { + ExchangeBind __req = new ExchangeBind() + { + _destination = @destination, + _source = @source, + _routingKey = @routingKey, + _nowait = @nowait, + _arguments = @arguments, + }; + if (nowait) { + ModelSend(__req,null,null); + return; + } + Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); + if (!(__repBase is ExchangeBindOk)) + { + throw new UnexpectedMethodException(__repBase); + } + } + public override void _Private_ExchangeDeclare (string @exchange, string @type, bool @passive, bool @durable, bool @autoDelete, bool @internal, bool @nowait, IDictionary @arguments) + { + ExchangeDeclare __req = new ExchangeDeclare() + { + _exchange = @exchange, + _type = @type, + _passive = @passive, + _durable = @durable, + _autoDelete = @autoDelete, + _internal = @internal, + _nowait = @nowait, + _arguments = @arguments, + }; + if (nowait) { + ModelSend(__req,null,null); + return; + } + Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); + if (!(__repBase is ExchangeDeclareOk)) + { + throw new UnexpectedMethodException(__repBase); + } + } + public override void _Private_ExchangeDelete (string @exchange, bool @ifUnused, bool @nowait) + { + ExchangeDelete __req = new ExchangeDelete() + { + _exchange = @exchange, + _ifUnused = @ifUnused, + _nowait = @nowait, + }; + if (nowait) { + ModelSend(__req,null,null); + return; + } + Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); + if (!(__repBase is ExchangeDeleteOk)) + { + throw new UnexpectedMethodException(__repBase); + } + } + public override void _Private_ExchangeUnbind (string @destination, string @source, string @routingKey, bool @nowait, IDictionary @arguments) + { + ExchangeUnbind __req = new ExchangeUnbind() + { + _destination = @destination, + _source = @source, + _routingKey = @routingKey, + _nowait = @nowait, + _arguments = @arguments, + }; + if (nowait) { + ModelSend(__req,null,null); + return; + } + Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); + if (!(__repBase is ExchangeUnbindOk)) + { + throw new UnexpectedMethodException(__repBase); + } + } + public override void _Private_QueueBind (string @queue, string @exchange, string @routingKey, bool @nowait, IDictionary @arguments) + { + QueueBind __req = new QueueBind() + { + _queue = @queue, + _exchange = @exchange, + _routingKey = @routingKey, + _nowait = @nowait, + _arguments = @arguments, + }; + if (nowait) { + ModelSend(__req,null,null); + return; + } + Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); + if (!(__repBase is QueueBindOk)) + { + throw new UnexpectedMethodException(__repBase); + } + } + public override void _Private_QueueDeclare (string @queue, bool @passive, bool @durable, bool @exclusive, bool @autoDelete, bool @nowait, IDictionary @arguments) + { + QueueDeclare __req = new QueueDeclare() + { + _queue = @queue, + _passive = @passive, + _durable = @durable, + _exclusive = @exclusive, + _autoDelete = @autoDelete, + _nowait = @nowait, + _arguments = @arguments, + }; + if (nowait) { + ModelSend(__req,null,null); + return; + } + ModelSend(__req,null,null); + } + public override uint _Private_QueueDelete (string @queue, bool @ifUnused, bool @ifEmpty, bool @nowait) + { + QueueDelete __req = new QueueDelete() + { + _queue = @queue, + _ifUnused = @ifUnused, + _ifEmpty = @ifEmpty, + _nowait = @nowait, + }; + if (nowait) { + ModelSend(__req,null,null); + return 0xFFFFFFFF; + } + Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); + if (!(__repBase is QueueDeleteOk __rep)) + { + throw new UnexpectedMethodException(__repBase); + } + return __rep._messageCount; + } + public override uint _Private_QueuePurge (string @queue, bool @nowait) + { + QueuePurge __req = new QueuePurge() + { + _queue = @queue, + _nowait = @nowait, + }; + if (nowait) { + ModelSend(__req,null,null); + return 0xFFFFFFFF; + } + Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); + if (!(__repBase is QueuePurgeOk __rep)) + { + throw new UnexpectedMethodException(__repBase); + } + return __rep._messageCount; + } + public override void BasicAck (ulong @deliveryTag, bool @multiple) + { + BasicAck __req = new BasicAck() + { + _deliveryTag = @deliveryTag, + _multiple = @multiple, + }; + ModelSend(__req,null,null); + } + public override void BasicNack (ulong @deliveryTag, bool @multiple, bool @requeue) + { + BasicNack __req = new BasicNack() + { + _deliveryTag = @deliveryTag, + _multiple = @multiple, + _requeue = @requeue, + }; + ModelSend(__req,null,null); + } + public override void BasicQos (uint @prefetchSize, ushort @prefetchCount, bool @global) + { + BasicQos __req = new BasicQos() + { + _prefetchSize = @prefetchSize, + _prefetchCount = @prefetchCount, + _global = @global, + }; + Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); + if (!(__repBase is BasicQosOk)) + { + throw new UnexpectedMethodException(__repBase); + } + } + public override void BasicRecoverAsync (bool @requeue) + { + BasicRecoverAsync __req = new BasicRecoverAsync() + { + _requeue = @requeue, + }; + ModelSend(__req,null,null); + } + public override void BasicReject (ulong @deliveryTag, bool @requeue) + { + BasicReject __req = new BasicReject() + { + _deliveryTag = @deliveryTag, + _requeue = @requeue, + }; + ModelSend(__req,null,null); + } + public override RabbitMQ.Client.IBasicProperties CreateBasicProperties () + { + return new BasicProperties(); + } + public override void QueueUnbind (string @queue, string @exchange, string @routingKey, IDictionary @arguments) + { + QueueUnbind __req = new QueueUnbind() + { + _queue = @queue, + _exchange = @exchange, + _routingKey = @routingKey, + _arguments = @arguments, + }; + Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); + if (!(__repBase is QueueUnbindOk)) + { + throw new UnexpectedMethodException(__repBase); + } + } + public override void TxCommit () + { + TxCommit __req = new TxCommit(); + Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); + if (!(__repBase is TxCommitOk)) + { + throw new UnexpectedMethodException(__repBase); + } + } + public override void TxRollback () + { + TxRollback __req = new TxRollback(); + Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); + if (!(__repBase is TxRollbackOk)) + { + throw new UnexpectedMethodException(__repBase); + } + } + public override void TxSelect () + { + TxSelect __req = new TxSelect(); + Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); + if (!(__repBase is TxSelectOk)) + { + throw new UnexpectedMethodException(__repBase); + } + } + public override bool DispatchAsynchronous(in IncomingCommand cmd) { + switch ((cmd.Method.ProtocolClassId << 16) | cmd.Method.ProtocolMethodId) + { + case (ClassConstants.Basic << 16) | BasicMethodConstants.Deliver: + { + var __impl = (BasicDeliver)cmd.Method; + HandleBasicDeliver(__impl._consumerTag, __impl._deliveryTag, __impl._redelivered, __impl._exchange, __impl._routingKey, (RabbitMQ.Client.IBasicProperties) cmd.Header, cmd.Body, cmd.TakeoverPayload()); + return true; + } + case (ClassConstants.Basic << 16) | BasicMethodConstants.Ack: + { + var __impl = (BasicAck)cmd.Method; + HandleBasicAck(__impl._deliveryTag, __impl._multiple); + return true; + } + case (ClassConstants.Basic << 16) | BasicMethodConstants.Cancel: + { + var __impl = (BasicCancel)cmd.Method; + HandleBasicCancel(__impl._consumerTag, __impl._nowait); + return true; + } + case (ClassConstants.Basic << 16) | BasicMethodConstants.CancelOk: + { + var __impl = (BasicCancelOk)cmd.Method; + HandleBasicCancelOk(__impl._consumerTag); + return true; + } + case (ClassConstants.Basic << 16) | BasicMethodConstants.ConsumeOk: + { + var __impl = (BasicConsumeOk)cmd.Method; + HandleBasicConsumeOk(__impl._consumerTag); + return true; + } + case (ClassConstants.Basic << 16) | BasicMethodConstants.GetEmpty: + { + HandleBasicGetEmpty(); + return true; + } + case (ClassConstants.Basic << 16) | BasicMethodConstants.GetOk: + { + var __impl = (BasicGetOk)cmd.Method; + HandleBasicGetOk(__impl._deliveryTag, __impl._redelivered, __impl._exchange, __impl._routingKey, __impl._messageCount, (RabbitMQ.Client.IBasicProperties) cmd.Header, cmd.Body, cmd.TakeoverPayload()); + return true; + } + case (ClassConstants.Basic << 16) | BasicMethodConstants.Nack: + { + var __impl = (BasicNack)cmd.Method; + HandleBasicNack(__impl._deliveryTag, __impl._multiple, __impl._requeue); + return true; + } + case (ClassConstants.Basic << 16) | BasicMethodConstants.RecoverOk: + { + HandleBasicRecoverOk(); + return true; + } + case (ClassConstants.Basic << 16) | BasicMethodConstants.Return: + { + var __impl = (BasicReturn)cmd.Method; + HandleBasicReturn(__impl._replyCode, __impl._replyText, __impl._exchange, __impl._routingKey, (RabbitMQ.Client.IBasicProperties) cmd.Header, cmd.Body, cmd.TakeoverPayload()); + return true; + } + case (ClassConstants.Channel << 16) | ChannelMethodConstants.Close: + { + var __impl = (ChannelClose)cmd.Method; + HandleChannelClose(__impl._replyCode, __impl._replyText, __impl._classId, __impl._methodId); + return true; + } + case (ClassConstants.Channel << 16) | ChannelMethodConstants.CloseOk: + { + HandleChannelCloseOk(); + return true; + } + case (ClassConstants.Channel << 16) | ChannelMethodConstants.Flow: + { + var __impl = (ChannelFlow)cmd.Method; + HandleChannelFlow(__impl._active); + return true; + } + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.Blocked: + { + var __impl = (ConnectionBlocked)cmd.Method; + HandleConnectionBlocked(__impl._reason); + return true; + } + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.Close: + { + var __impl = (ConnectionClose)cmd.Method; + HandleConnectionClose(__impl._replyCode, __impl._replyText, __impl._classId, __impl._methodId); + return true; + } + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.OpenOk: + { + var __impl = (ConnectionOpenOk)cmd.Method; + HandleConnectionOpenOk(__impl._reserved1); + return true; + } + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.Secure: + { + var __impl = (ConnectionSecure)cmd.Method; + HandleConnectionSecure(__impl._challenge); + return true; + } + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.Start: + { + var __impl = (ConnectionStart)cmd.Method; + HandleConnectionStart(__impl._versionMajor, __impl._versionMinor, __impl._serverProperties, __impl._mechanisms, __impl._locales); + return true; + } + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.Tune: + { + var __impl = (ConnectionTune)cmd.Method; + HandleConnectionTune(__impl._channelMax, __impl._frameMax, __impl._heartbeat); + return true; + } + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.Unblocked: + { + HandleConnectionUnblocked(); + return true; + } + case (ClassConstants.Queue << 16) | QueueMethodConstants.DeclareOk: + { + var __impl = (QueueDeclareOk)cmd.Method; + HandleQueueDeclareOk(__impl._queue, __impl._messageCount, __impl._consumerCount); + return true; + } + default: return false; + } + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/Protocol.cs b/projects/RabbitMQ.Client/client/framing/Protocol.cs new file mode 100644 index 0000000000..19573e5534 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/Protocol.cs @@ -0,0 +1,151 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System; +using RabbitMQ.Client.Framing.Impl; + +namespace RabbitMQ.Client.Framing +{ + internal sealed class Protocol : RabbitMQ.Client.Framing.Impl.ProtocolBase + { + ///Protocol major version (= 0) + public override int MajorVersion => 0; + + ///Protocol minor version (= 9) + public override int MinorVersion => 9; + + ///Protocol revision (= 1) + public override int Revision => 1; + + ///Protocol API name (= :AMQP_0_9_1) + public override string ApiName => ":AMQP_0_9_1"; + + ///Default TCP port (= 5672) + public override int DefaultPort => 5672; + + internal override Client.Impl.MethodBase DecodeMethodFrom(ReadOnlySpan span) + { + ushort classId = Util.NetworkOrderDeserializer.ReadUInt16(span); + ushort methodId = Util.NetworkOrderDeserializer.ReadUInt16(span.Slice(2)); + Client.Impl.MethodBase result = DecodeMethodFrom(classId, methodId); + if(result != null) + { + Client.Impl.MethodArgumentReader reader = new Client.Impl.MethodArgumentReader(span.Slice(4)); + result.ReadArgumentsFrom(ref reader); + return result; + } + + throw new Client.Exceptions.UnknownClassOrMethodException(classId, methodId); + } + + internal Client.Impl.MethodBase DecodeMethodFrom(ushort classId, ushort methodId) + { + switch ((classId << 16) | methodId) + { + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.Start: return new Impl.ConnectionStart(); + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.StartOk: return new Impl.ConnectionStartOk(); + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.Secure: return new Impl.ConnectionSecure(); + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.SecureOk: return new Impl.ConnectionSecureOk(); + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.Tune: return new Impl.ConnectionTune(); + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.TuneOk: return new Impl.ConnectionTuneOk(); + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.Open: return new Impl.ConnectionOpen(); + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.OpenOk: return new Impl.ConnectionOpenOk(); + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.Close: return new Impl.ConnectionClose(); + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.CloseOk: return new Impl.ConnectionCloseOk(); + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.Blocked: return new Impl.ConnectionBlocked(); + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.Unblocked: return new Impl.ConnectionUnblocked(); + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.UpdateSecret: return new Impl.ConnectionUpdateSecret(); + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.UpdateSecretOk: return new Impl.ConnectionUpdateSecretOk(); + case (ClassConstants.Channel << 16) | ChannelMethodConstants.Open: return new Impl.ChannelOpen(); + case (ClassConstants.Channel << 16) | ChannelMethodConstants.OpenOk: return new Impl.ChannelOpenOk(); + case (ClassConstants.Channel << 16) | ChannelMethodConstants.Flow: return new Impl.ChannelFlow(); + case (ClassConstants.Channel << 16) | ChannelMethodConstants.FlowOk: return new Impl.ChannelFlowOk(); + case (ClassConstants.Channel << 16) | ChannelMethodConstants.Close: return new Impl.ChannelClose(); + case (ClassConstants.Channel << 16) | ChannelMethodConstants.CloseOk: return new Impl.ChannelCloseOk(); + case (ClassConstants.Exchange << 16) | ExchangeMethodConstants.Declare: return new Impl.ExchangeDeclare(); + case (ClassConstants.Exchange << 16) | ExchangeMethodConstants.DeclareOk: return new Impl.ExchangeDeclareOk(); + case (ClassConstants.Exchange << 16) | ExchangeMethodConstants.Delete: return new Impl.ExchangeDelete(); + case (ClassConstants.Exchange << 16) | ExchangeMethodConstants.DeleteOk: return new Impl.ExchangeDeleteOk(); + case (ClassConstants.Exchange << 16) | ExchangeMethodConstants.Bind: return new Impl.ExchangeBind(); + case (ClassConstants.Exchange << 16) | ExchangeMethodConstants.BindOk: return new Impl.ExchangeBindOk(); + case (ClassConstants.Exchange << 16) | ExchangeMethodConstants.Unbind: return new Impl.ExchangeUnbind(); + case (ClassConstants.Exchange << 16) | ExchangeMethodConstants.UnbindOk: return new Impl.ExchangeUnbindOk(); + case (ClassConstants.Queue << 16) | QueueMethodConstants.Declare: return new Impl.QueueDeclare(); + case (ClassConstants.Queue << 16) | QueueMethodConstants.DeclareOk: return new Impl.QueueDeclareOk(); + case (ClassConstants.Queue << 16) | QueueMethodConstants.Bind: return new Impl.QueueBind(); + case (ClassConstants.Queue << 16) | QueueMethodConstants.BindOk: return new Impl.QueueBindOk(); + case (ClassConstants.Queue << 16) | QueueMethodConstants.Unbind: return new Impl.QueueUnbind(); + case (ClassConstants.Queue << 16) | QueueMethodConstants.UnbindOk: return new Impl.QueueUnbindOk(); + case (ClassConstants.Queue << 16) | QueueMethodConstants.Purge: return new Impl.QueuePurge(); + case (ClassConstants.Queue << 16) | QueueMethodConstants.PurgeOk: return new Impl.QueuePurgeOk(); + case (ClassConstants.Queue << 16) | QueueMethodConstants.Delete: return new Impl.QueueDelete(); + case (ClassConstants.Queue << 16) | QueueMethodConstants.DeleteOk: return new Impl.QueueDeleteOk(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.Qos: return new Impl.BasicQos(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.QosOk: return new Impl.BasicQosOk(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.Consume: return new Impl.BasicConsume(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.ConsumeOk: return new Impl.BasicConsumeOk(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.Cancel: return new Impl.BasicCancel(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.CancelOk: return new Impl.BasicCancelOk(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.Publish: return new Impl.BasicPublish(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.Return: return new Impl.BasicReturn(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.Deliver: return new Impl.BasicDeliver(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.Get: return new Impl.BasicGet(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.GetOk: return new Impl.BasicGetOk(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.GetEmpty: return new Impl.BasicGetEmpty(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.Ack: return new Impl.BasicAck(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.Reject: return new Impl.BasicReject(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.RecoverAsync: return new Impl.BasicRecoverAsync(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.Recover: return new Impl.BasicRecover(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.RecoverOk: return new Impl.BasicRecoverOk(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.Nack: return new Impl.BasicNack(); + case (ClassConstants.Tx << 16) | TxMethodConstants.Select: return new Impl.TxSelect(); + case (ClassConstants.Tx << 16) | TxMethodConstants.SelectOk: return new Impl.TxSelectOk(); + case (ClassConstants.Tx << 16) | TxMethodConstants.Commit: return new Impl.TxCommit(); + case (ClassConstants.Tx << 16) | TxMethodConstants.CommitOk: return new Impl.TxCommitOk(); + case (ClassConstants.Tx << 16) | TxMethodConstants.Rollback: return new Impl.TxRollback(); + case (ClassConstants.Tx << 16) | TxMethodConstants.RollbackOk: return new Impl.TxRollbackOk(); + case (ClassConstants.Confirm << 16) | ConfirmMethodConstants.Select: return new Impl.ConfirmSelect(); + case (ClassConstants.Confirm << 16) | ConfirmMethodConstants.SelectOk: return new Impl.ConfirmSelectOk(); + default: return null; + } + } + + + internal override Client.Impl.ContentHeaderBase DecodeContentHeaderFrom(ushort classId) + { + switch (classId) + { + case 60: return new BasicProperties(); + default: throw new Client.Exceptions.UnknownClassOrMethodException(classId, 0); + } + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/QueueBind.cs b/projects/RabbitMQ.Client/client/framing/QueueBind.cs new file mode 100644 index 0000000000..fe660cbde9 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/QueueBind.cs @@ -0,0 +1,114 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Collections.Generic; +using System.Text; +using RabbitMQ.Client.Impl; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class QueueBind : Client.Impl.MethodBase + { + public ushort _reserved1; + public string _queue; + public string _exchange; + public string _routingKey; + public bool _nowait; + public IDictionary _arguments; + + ushort Reserved1 => _reserved1; + string Queue => _queue; + string Exchange => _exchange; + string RoutingKey => _routingKey; + bool Nowait => _nowait; + IDictionary Arguments => _arguments; + + public QueueBind() {} + public QueueBind(ushort @Reserved1, string @Queue, string @Exchange, string @RoutingKey, bool @Nowait, IDictionary @Arguments) + { + _reserved1 = @Reserved1; + _queue = @Queue; + _exchange = @Exchange; + _routingKey = @RoutingKey; + _nowait = @Nowait; + _arguments = @Arguments; + } + + public override ushort ProtocolClassId => ClassConstants.Queue; + public override ushort ProtocolMethodId => QueueMethodConstants.Bind; + public override string ProtocolMethodName => "queue.bind"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _reserved1 = reader.ReadShort(); + _queue = reader.ReadShortstr(); + _exchange = reader.ReadShortstr(); + _routingKey = reader.ReadShortstr(); + _nowait = reader.ReadBit(); + _arguments = reader.ReadTable(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteShort(_reserved1); + writer.WriteShortstr(_queue); + writer.WriteShortstr(_exchange); + writer.WriteShortstr(_routingKey); + writer.WriteBit(_nowait); + writer.EndBits(); + writer.WriteTable(_arguments); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 6; // bytes for _reserved1, length of _queue, length of _exchange, length of _routingKey, bit fields + bufferSize += Encoding.UTF8.GetByteCount(_queue); // _queue in bytes + bufferSize += Encoding.UTF8.GetByteCount(_exchange); // _exchange in bytes + bufferSize += Encoding.UTF8.GetByteCount(_routingKey); // _routingKey in bytes + bufferSize += WireFormatting.GetTableByteCount(_arguments); // _arguments in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_reserved1).Append(','); + sb.Append(_queue).Append(','); + sb.Append(_exchange).Append(','); + sb.Append(_routingKey).Append(','); + sb.Append(_nowait).Append(','); + sb.Append(_arguments); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/QueueBindOk.cs b/projects/RabbitMQ.Client/client/framing/QueueBindOk.cs new file mode 100644 index 0000000000..dfc4247d9e --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/QueueBindOk.cs @@ -0,0 +1,70 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class QueueBindOk : Client.Impl.MethodBase + { + + + public QueueBindOk() + { + } + + public override ushort ProtocolClassId => ClassConstants.Queue; + public override ushort ProtocolMethodId => QueueMethodConstants.BindOk; + public override string ProtocolMethodName => "queue.bind-ok"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 0; + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/QueueDeclare.cs b/projects/RabbitMQ.Client/client/framing/QueueDeclare.cs new file mode 100644 index 0000000000..06a40226fb --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/QueueDeclare.cs @@ -0,0 +1,124 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Collections.Generic; +using System.Text; +using RabbitMQ.Client.Impl; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class QueueDeclare : Client.Impl.MethodBase + { + public ushort _reserved1; + public string _queue; + public bool _passive; + public bool _durable; + public bool _exclusive; + public bool _autoDelete; + public bool _nowait; + public IDictionary _arguments; + + ushort Reserved1 => _reserved1; + string Queue => _queue; + bool Passive => _passive; + bool Durable => _durable; + bool Exclusive => _exclusive; + bool AutoDelete => _autoDelete; + bool Nowait => _nowait; + IDictionary Arguments => _arguments; + + public QueueDeclare() {} + public QueueDeclare(ushort @Reserved1, string @Queue, bool @Passive, bool @Durable, bool @Exclusive, bool @AutoDelete, bool @Nowait, IDictionary @Arguments) + { + _reserved1 = @Reserved1; + _queue = @Queue; + _passive = @Passive; + _durable = @Durable; + _exclusive = @Exclusive; + _autoDelete = @AutoDelete; + _nowait = @Nowait; + _arguments = @Arguments; + } + + public override ushort ProtocolClassId => ClassConstants.Queue; + public override ushort ProtocolMethodId => QueueMethodConstants.Declare; + public override string ProtocolMethodName => "queue.declare"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _reserved1 = reader.ReadShort(); + _queue = reader.ReadShortstr(); + _passive = reader.ReadBit(); + _durable = reader.ReadBit(); + _exclusive = reader.ReadBit(); + _autoDelete = reader.ReadBit(); + _nowait = reader.ReadBit(); + _arguments = reader.ReadTable(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteShort(_reserved1); + writer.WriteShortstr(_queue); + writer.WriteBit(_passive); + writer.WriteBit(_durable); + writer.WriteBit(_exclusive); + writer.WriteBit(_autoDelete); + writer.WriteBit(_nowait); + writer.EndBits(); + writer.WriteTable(_arguments); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 4; // bytes for _reserved1, length of _queue, bit fields + bufferSize += Encoding.UTF8.GetByteCount(_queue); // _queue in bytes + bufferSize += WireFormatting.GetTableByteCount(_arguments); // _arguments in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_reserved1).Append(','); + sb.Append(_queue).Append(','); + sb.Append(_passive).Append(','); + sb.Append(_durable).Append(','); + sb.Append(_exclusive).Append(','); + sb.Append(_autoDelete).Append(','); + sb.Append(_nowait).Append(','); + sb.Append(_arguments); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/QueueDeclareOk.cs b/projects/RabbitMQ.Client/client/framing/QueueDeclareOk.cs new file mode 100644 index 0000000000..4a6ebeccb1 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/QueueDeclareOk.cs @@ -0,0 +1,90 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class QueueDeclareOk : Client.Impl.MethodBase + { + public string _queue; + public uint _messageCount; + public uint _consumerCount; + + string Queue => _queue; + uint MessageCount => _messageCount; + uint ConsumerCount => _consumerCount; + + public QueueDeclareOk() {} + public QueueDeclareOk(string @Queue, uint @MessageCount, uint @ConsumerCount) + { + _queue = @Queue; + _messageCount = @MessageCount; + _consumerCount = @ConsumerCount; + } + + public override ushort ProtocolClassId => ClassConstants.Queue; + public override ushort ProtocolMethodId => QueueMethodConstants.DeclareOk; + public override string ProtocolMethodName => "queue.declare-ok"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _queue = reader.ReadShortstr(); + _messageCount = reader.ReadLong(); + _consumerCount = reader.ReadLong(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteShortstr(_queue); + writer.WriteLong(_messageCount); + writer.WriteLong(_consumerCount); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 9; // bytes for length of _queue, _messageCount, _consumerCount + bufferSize += Encoding.UTF8.GetByteCount(_queue); // _queue in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_queue).Append(','); + sb.Append(_messageCount).Append(','); + sb.Append(_consumerCount); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/QueueDelete.cs b/projects/RabbitMQ.Client/client/framing/QueueDelete.cs new file mode 100644 index 0000000000..a122a353ea --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/QueueDelete.cs @@ -0,0 +1,103 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class QueueDelete : Client.Impl.MethodBase + { + public ushort _reserved1; + public string _queue; + public bool _ifUnused; + public bool _ifEmpty; + public bool _nowait; + + ushort Reserved1 => _reserved1; + string Queue => _queue; + bool IfUnused => _ifUnused; + bool IfEmpty => _ifEmpty; + bool Nowait => _nowait; + + public QueueDelete() {} + public QueueDelete(ushort @Reserved1, string @Queue, bool @IfUnused, bool @IfEmpty, bool @Nowait) + { + _reserved1 = @Reserved1; + _queue = @Queue; + _ifUnused = @IfUnused; + _ifEmpty = @IfEmpty; + _nowait = @Nowait; + } + + public override ushort ProtocolClassId => ClassConstants.Queue; + public override ushort ProtocolMethodId => QueueMethodConstants.Delete; + public override string ProtocolMethodName => "queue.delete"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _reserved1 = reader.ReadShort(); + _queue = reader.ReadShortstr(); + _ifUnused = reader.ReadBit(); + _ifEmpty = reader.ReadBit(); + _nowait = reader.ReadBit(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteShort(_reserved1); + writer.WriteShortstr(_queue); + writer.WriteBit(_ifUnused); + writer.WriteBit(_ifEmpty); + writer.WriteBit(_nowait); + writer.EndBits(); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 4; // bytes for _reserved1, length of _queue, bit fields + bufferSize += Encoding.UTF8.GetByteCount(_queue); // _queue in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_reserved1).Append(','); + sb.Append(_queue).Append(','); + sb.Append(_ifUnused).Append(','); + sb.Append(_ifEmpty).Append(','); + sb.Append(_nowait); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/QueueDeleteOk.cs b/projects/RabbitMQ.Client/client/framing/QueueDeleteOk.cs new file mode 100644 index 0000000000..e9e7e46838 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/QueueDeleteOk.cs @@ -0,0 +1,77 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class QueueDeleteOk : Client.Impl.MethodBase + { + public uint _messageCount; + + uint MessageCount => _messageCount; + + public QueueDeleteOk() {} + public QueueDeleteOk(uint @MessageCount) + { + _messageCount = @MessageCount; + } + + public override ushort ProtocolClassId => ClassConstants.Queue; + public override ushort ProtocolMethodId => QueueMethodConstants.DeleteOk; + public override string ProtocolMethodName => "queue.delete-ok"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _messageCount = reader.ReadLong(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteLong(_messageCount); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 4; // bytes for _messageCount + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_messageCount); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/QueueMethodConstants.cs b/projects/RabbitMQ.Client/client/framing/QueueMethodConstants.cs new file mode 100644 index 0000000000..6395e8aab9 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/QueueMethodConstants.cs @@ -0,0 +1,47 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +namespace RabbitMQ.Client.Framing.Impl +{ + internal static class QueueMethodConstants + { + internal const ushort Declare = 10; + internal const ushort DeclareOk = 11; + internal const ushort Bind = 20; + internal const ushort BindOk = 21; + internal const ushort Unbind = 50; + internal const ushort UnbindOk = 51; + internal const ushort Purge = 30; + internal const ushort PurgeOk = 31; + internal const ushort Delete = 40; + internal const ushort DeleteOk = 41; + } +} diff --git a/projects/RabbitMQ.Client/client/framing/QueuePurge.cs b/projects/RabbitMQ.Client/client/framing/QueuePurge.cs new file mode 100644 index 0000000000..9aee86e622 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/QueuePurge.cs @@ -0,0 +1,91 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class QueuePurge : Client.Impl.MethodBase + { + public ushort _reserved1; + public string _queue; + public bool _nowait; + + ushort Reserved1 => _reserved1; + string Queue => _queue; + bool Nowait => _nowait; + + public QueuePurge() {} + public QueuePurge(ushort @Reserved1, string @Queue, bool @Nowait) + { + _reserved1 = @Reserved1; + _queue = @Queue; + _nowait = @Nowait; + } + + public override ushort ProtocolClassId => ClassConstants.Queue; + public override ushort ProtocolMethodId => QueueMethodConstants.Purge; + public override string ProtocolMethodName => "queue.purge"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _reserved1 = reader.ReadShort(); + _queue = reader.ReadShortstr(); + _nowait = reader.ReadBit(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteShort(_reserved1); + writer.WriteShortstr(_queue); + writer.WriteBit(_nowait); + writer.EndBits(); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 4; // bytes for _reserved1, length of _queue, bit fields + bufferSize += Encoding.UTF8.GetByteCount(_queue); // _queue in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_reserved1).Append(','); + sb.Append(_queue).Append(','); + sb.Append(_nowait); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/QueuePurgeOk.cs b/projects/RabbitMQ.Client/client/framing/QueuePurgeOk.cs new file mode 100644 index 0000000000..90cb2008db --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/QueuePurgeOk.cs @@ -0,0 +1,77 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class QueuePurgeOk : Client.Impl.MethodBase + { + public uint _messageCount; + + uint MessageCount => _messageCount; + + public QueuePurgeOk() {} + public QueuePurgeOk(uint @MessageCount) + { + _messageCount = @MessageCount; + } + + public override ushort ProtocolClassId => ClassConstants.Queue; + public override ushort ProtocolMethodId => QueueMethodConstants.PurgeOk; + public override string ProtocolMethodName => "queue.purge-ok"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _messageCount = reader.ReadLong(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteLong(_messageCount); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 4; // bytes for _messageCount + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_messageCount); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/QueueUnbind.cs b/projects/RabbitMQ.Client/client/framing/QueueUnbind.cs new file mode 100644 index 0000000000..989f383728 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/QueueUnbind.cs @@ -0,0 +1,107 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Collections.Generic; +using System.Text; +using RabbitMQ.Client.Impl; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class QueueUnbind : Client.Impl.MethodBase + { + public ushort _reserved1; + public string _queue; + public string _exchange; + public string _routingKey; + public IDictionary _arguments; + + ushort Reserved1 => _reserved1; + string Queue => _queue; + string Exchange => _exchange; + string RoutingKey => _routingKey; + IDictionary Arguments => _arguments; + + public QueueUnbind() {} + public QueueUnbind(ushort @Reserved1, string @Queue, string @Exchange, string @RoutingKey, IDictionary @Arguments) + { + _reserved1 = @Reserved1; + _queue = @Queue; + _exchange = @Exchange; + _routingKey = @RoutingKey; + _arguments = @Arguments; + } + + public override ushort ProtocolClassId => ClassConstants.Queue; + public override ushort ProtocolMethodId => QueueMethodConstants.Unbind; + public override string ProtocolMethodName => "queue.unbind"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + _reserved1 = reader.ReadShort(); + _queue = reader.ReadShortstr(); + _exchange = reader.ReadShortstr(); + _routingKey = reader.ReadShortstr(); + _arguments = reader.ReadTable(); + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + writer.WriteShort(_reserved1); + writer.WriteShortstr(_queue); + writer.WriteShortstr(_exchange); + writer.WriteShortstr(_routingKey); + writer.WriteTable(_arguments); + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 5; // bytes for _reserved1, length of _queue, length of _exchange, length of _routingKey + bufferSize += Encoding.UTF8.GetByteCount(_queue); // _queue in bytes + bufferSize += Encoding.UTF8.GetByteCount(_exchange); // _exchange in bytes + bufferSize += Encoding.UTF8.GetByteCount(_routingKey); // _routingKey in bytes + bufferSize += WireFormatting.GetTableByteCount(_arguments); // _arguments in bytes + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(_reserved1).Append(','); + sb.Append(_queue).Append(','); + sb.Append(_exchange).Append(','); + sb.Append(_routingKey).Append(','); + sb.Append(_arguments); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/QueueUnbindOk.cs b/projects/RabbitMQ.Client/client/framing/QueueUnbindOk.cs new file mode 100644 index 0000000000..5ab977f24c --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/QueueUnbindOk.cs @@ -0,0 +1,70 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class QueueUnbindOk : Client.Impl.MethodBase + { + + + public QueueUnbindOk() + { + } + + public override ushort ProtocolClassId => ClassConstants.Queue; + public override ushort ProtocolMethodId => QueueMethodConstants.UnbindOk; + public override string ProtocolMethodName => "queue.unbind-ok"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 0; + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(')'); + } + } +} diff --git a/projects/Apigen/apigen/AmqpMethod.cs b/projects/RabbitMQ.Client/client/framing/TxCommit.cs similarity index 59% rename from projects/Apigen/apigen/AmqpMethod.cs rename to projects/RabbitMQ.Client/client/framing/TxCommit.cs index 87701c912a..571d6573aa 100644 --- a/projects/Apigen/apigen/AmqpMethod.cs +++ b/projects/RabbitMQ.Client/client/framing/TxCommit.cs @@ -29,44 +29,42 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Collections.Generic; -using System.Xml; +using System.Text; -namespace RabbitMQ.Client.Apigen +namespace RabbitMQ.Client.Framing.Impl { - public class AmqpMethod: AmqpEntity { - public IList m_Fields; - public IList m_ResponseMethods; + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class TxCommit : Client.Impl.MethodBase + { - public AmqpMethod(XmlNode n) - : base(n) + + public TxCommit() + { + } + + public override ushort ProtocolClassId => ClassConstants.Tx; + public override ushort ProtocolMethodId => TxMethodConstants.Commit; + public override string ProtocolMethodName => "tx.commit"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) { - m_Fields = new List(); - foreach (XmlNode f in n.SelectNodes("field")) { - m_Fields.Add(new AmqpField(f)); - } - m_ResponseMethods = new List(); - foreach (XmlNode r in n.SelectNodes("response")) { - m_ResponseMethods.Add(Apigen.GetString(r, "@name")); - } } - public bool HasContent { - get { - return GetString("@content", null) != null; - } + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { } - public bool IsSimpleRpcRequest { - get { - return m_ResponseMethods.Count == 1; - } + public override int GetRequiredBufferSize() + { + int bufferSize = 0; + return bufferSize; } - public int Index { - get { - return GetInt("@index"); - } + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(')'); } } } diff --git a/projects/RabbitMQ.Client/client/framing/TxCommitOk.cs b/projects/RabbitMQ.Client/client/framing/TxCommitOk.cs new file mode 100644 index 0000000000..0c445fc280 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/TxCommitOk.cs @@ -0,0 +1,70 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class TxCommitOk : Client.Impl.MethodBase + { + + + public TxCommitOk() + { + } + + public override ushort ProtocolClassId => ClassConstants.Tx; + public override ushort ProtocolMethodId => TxMethodConstants.CommitOk; + public override string ProtocolMethodName => "tx.commit-ok"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 0; + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/TxMethodConstants.cs b/projects/RabbitMQ.Client/client/framing/TxMethodConstants.cs new file mode 100644 index 0000000000..1497b49246 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/TxMethodConstants.cs @@ -0,0 +1,43 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +namespace RabbitMQ.Client.Framing.Impl +{ + internal static class TxMethodConstants + { + internal const ushort Select = 10; + internal const ushort SelectOk = 11; + internal const ushort Commit = 20; + internal const ushort CommitOk = 21; + internal const ushort Rollback = 30; + internal const ushort RollbackOk = 31; + } +} diff --git a/projects/RabbitMQ.Client/client/framing/TxRollback.cs b/projects/RabbitMQ.Client/client/framing/TxRollback.cs new file mode 100644 index 0000000000..d3c321dd10 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/TxRollback.cs @@ -0,0 +1,70 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class TxRollback : Client.Impl.MethodBase + { + + + public TxRollback() + { + } + + public override ushort ProtocolClassId => ClassConstants.Tx; + public override ushort ProtocolMethodId => TxMethodConstants.Rollback; + public override string ProtocolMethodName => "tx.rollback"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 0; + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/TxRollbackOk.cs b/projects/RabbitMQ.Client/client/framing/TxRollbackOk.cs new file mode 100644 index 0000000000..5a1d15d90c --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/TxRollbackOk.cs @@ -0,0 +1,70 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class TxRollbackOk : Client.Impl.MethodBase + { + + + public TxRollbackOk() + { + } + + public override ushort ProtocolClassId => ClassConstants.Tx; + public override ushort ProtocolMethodId => TxMethodConstants.RollbackOk; + public override string ProtocolMethodName => "tx.rollback-ok"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 0; + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/TxSelect.cs b/projects/RabbitMQ.Client/client/framing/TxSelect.cs new file mode 100644 index 0000000000..247b5fcd23 --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/TxSelect.cs @@ -0,0 +1,70 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class TxSelect : Client.Impl.MethodBase + { + + + public TxSelect() + { + } + + public override ushort ProtocolClassId => ClassConstants.Tx; + public override ushort ProtocolMethodId => TxMethodConstants.Select; + public override string ProtocolMethodName => "tx.select"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 0; + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(')'); + } + } +} diff --git a/projects/RabbitMQ.Client/client/framing/TxSelectOk.cs b/projects/RabbitMQ.Client/client/framing/TxSelectOk.cs new file mode 100644 index 0000000000..4145e817ca --- /dev/null +++ b/projects/RabbitMQ.Client/client/framing/TxSelectOk.cs @@ -0,0 +1,70 @@ +// This source code is dual-licensed under the Apache License, version +// 2.0, and the Mozilla Public License, version 2.0. +// +// The APL v2.0: +// +//--------------------------------------------------------------------------- +// Copyright (c) 2007-2020 VMware, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +// +// The MPL v2.0: +// +//--------------------------------------------------------------------------- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// +// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. +//--------------------------------------------------------------------------- + +using System.Text; + +namespace RabbitMQ.Client.Framing.Impl +{ + /// Autogenerated type. Private implementation class - do not use directly. + internal sealed class TxSelectOk : Client.Impl.MethodBase + { + + + public TxSelectOk() + { + } + + public override ushort ProtocolClassId => ClassConstants.Tx; + public override ushort ProtocolMethodId => TxMethodConstants.SelectOk; + public override string ProtocolMethodName => "tx.select-ok"; + public override bool HasContent => false; + + public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + { + } + + public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + { + } + + public override int GetRequiredBufferSize() + { + int bufferSize = 0; + return bufferSize; + } + + public override void AppendArgumentDebugStringTo(StringBuilder sb) + { + sb.Append('('); + sb.Append(')'); + } + } +} From f8e476087aa2e82ccc1705db8ee0a4dcf68da036 Mon Sep 17 00:00:00 2001 From: bollhals Date: Fri, 14 Aug 2020 19:52:51 +0200 Subject: [PATCH 2/4] style cleanup --- projects/RabbitMQ.Client/client/api/IModel.cs | 69 +-- .../client/framing/BasicAck.cs | 26 +- .../client/framing/BasicCancel.cs | 23 +- .../client/framing/BasicCancelOk.cs | 17 +- .../client/framing/BasicConsume.cs | 53 +- .../client/framing/BasicConsumeOk.cs | 17 +- .../client/framing/BasicDeliver.cs | 35 +- .../client/framing/BasicGet.cs | 27 +- .../client/framing/BasicGetEmpty.cs | 17 +- .../client/framing/BasicGetOk.cs | 35 +- .../client/framing/BasicNack.cs | 30 +- .../client/framing/BasicProperties.cs | 29 +- .../client/framing/BasicPublish.cs | 35 +- .../client/framing/BasicQos.cs | 30 +- .../client/framing/BasicQosOk.cs | 14 +- .../client/framing/BasicRecover.cs | 22 +- .../client/framing/BasicRecoverAsync.cs | 22 +- .../client/framing/BasicRecoverOk.cs | 14 +- .../client/framing/BasicReject.cs | 26 +- .../client/framing/BasicReturn.cs | 31 +- .../client/framing/ChannelClose.cs | 31 +- .../client/framing/ChannelCloseOk.cs | 14 +- .../client/framing/ChannelFlow.cs | 22 +- .../client/framing/ChannelFlowOk.cs | 19 +- .../client/framing/ChannelOpen.cs | 17 +- .../client/framing/ChannelOpenOk.cs | 19 +- .../client/framing/ConfirmSelect.cs | 22 +- .../client/framing/ConfirmSelectOk.cs | 14 +- .../client/framing/ConnectionBlocked.cs | 17 +- .../client/framing/ConnectionClose.cs | 31 +- .../client/framing/ConnectionCloseOk.cs | 14 +- .../client/framing/ConnectionOpen.cs | 27 +- .../client/framing/ConnectionOpenOk.cs | 17 +- .../client/framing/ConnectionSecure.cs | 19 +- .../client/framing/ConnectionSecureOk.cs | 19 +- .../client/framing/ConnectionStart.cs | 42 +- .../client/framing/ConnectionStartOk.cs | 37 +- .../client/framing/ConnectionTune.cs | 30 +- .../client/framing/ConnectionTuneOk.cs | 30 +- .../client/framing/ConnectionUnblocked.cs | 14 +- .../client/framing/ConnectionUpdateSecret.cs | 23 +- .../framing/ConnectionUpdateSecretOk.cs | 14 +- .../client/framing/ExchangeBind.cs | 45 +- .../client/framing/ExchangeBindOk.cs | 14 +- .../client/framing/ExchangeDeclare.cs | 57 +-- .../client/framing/ExchangeDeclareOk.cs | 14 +- .../client/framing/ExchangeDelete.cs | 31 +- .../client/framing/ExchangeDeleteOk.cs | 14 +- .../client/framing/ExchangeUnbind.cs | 45 +- .../client/framing/ExchangeUnbindOk.cs | 14 +- .../RabbitMQ.Client/client/framing/Model.cs | 475 +++++++----------- .../client/framing/Protocol.cs | 132 ++--- .../client/framing/QueueBind.cs | 45 +- .../client/framing/QueueBindOk.cs | 14 +- .../client/framing/QueueDeclare.cs | 53 +- .../client/framing/QueueDeclareOk.cs | 27 +- .../client/framing/QueueDelete.cs | 35 +- .../client/framing/QueueDeleteOk.cs | 22 +- .../client/framing/QueuePurge.cs | 27 +- .../client/framing/QueuePurgeOk.cs | 22 +- .../client/framing/QueueUnbind.cs | 41 +- .../client/framing/QueueUnbindOk.cs | 14 +- .../client/framing/TxCommit.cs | 14 +- .../client/framing/TxCommitOk.cs | 14 +- .../client/framing/TxRollback.cs | 14 +- .../client/framing/TxRollbackOk.cs | 14 +- .../client/framing/TxSelect.cs | 14 +- .../client/framing/TxSelectOk.cs | 14 +- .../client/impl/ContentHeaderBase.cs | 5 +- .../RabbitMQ.Client/client/impl/IFullModel.cs | 347 ++----------- .../RabbitMQ.Client/client/impl/MethodBase.cs | 3 - .../RabbitMQ.Client/client/impl/ModelBase.cs | 9 +- 72 files changed, 717 insertions(+), 1936 deletions(-) diff --git a/projects/RabbitMQ.Client/client/api/IModel.cs b/projects/RabbitMQ.Client/client/api/IModel.cs index bf9b32db46..249c627d30 100644 --- a/projects/RabbitMQ.Client/client/api/IModel.cs +++ b/projects/RabbitMQ.Client/client/api/IModel.cs @@ -32,7 +32,6 @@ using System; using System.Collections.Generic; -using RabbitMQ.Client.Apigen.Attributes; using RabbitMQ.Client.Events; namespace RabbitMQ.Client @@ -154,7 +153,6 @@ public interface IModel : IDisposable /// In comparison to normal method, will not throw /// or or any other during closing model. /// - [AmqpMethodDoNotImplement(null)] void Abort(); /// @@ -170,7 +168,6 @@ public interface IModel : IDisposable /// A message indicating the reason for closing the model /// /// - [AmqpMethodDoNotImplement(null)] void Abort(ushort replyCode, string replyText); /// @@ -181,7 +178,6 @@ public interface IModel : IDisposable /// /// Delete a Basic content-class consumer. /// - [AmqpMethodDoNotImplement(null)] void BasicCancel(string consumerTag); /// @@ -191,7 +187,6 @@ public interface IModel : IDisposable void BasicCancelNoWait(string consumerTag); /// Start a Basic content-class consumer. - [AmqpMethodDoNotImplement(null)] string BasicConsume( string queue, bool autoAck, @@ -206,7 +201,6 @@ string BasicConsume( /// one is available; returns null if the server answers that /// no messages are currently available. See also . /// - [AmqpMethodDoNotImplement(null)] BasicGetResult BasicGet(string queue, bool autoAck); /// Reject one or more delivered message(s). @@ -220,9 +214,7 @@ string BasicConsume( /// Routing key must be shorter than 255 bytes. /// /// - [AmqpMethodDoNotImplement(null)] - void BasicPublish(string exchange, string routingKey, bool mandatory, - IBasicProperties basicProperties, ReadOnlyMemory body); + void BasicPublish(string exchange, string routingKey, bool mandatory, IBasicProperties basicProperties, ReadOnlyMemory body); /// /// Configures QoS parameters of the Basic content-class. @@ -233,7 +225,6 @@ void BasicPublish(string exchange, string routingKey, bool mandatory, /// Indicates that a consumer has recovered. /// Deprecated. Should not be used. /// - [AmqpMethodDoNotImplement(null)] void BasicRecover(bool requeue); /// @@ -252,7 +243,6 @@ void BasicPublish(string exchange, string routingKey, bool mandatory, /// operation to complete. This method will not return to the /// caller until the shutdown is complete. /// - [AmqpMethodDoNotImplement(null)] void Close(); /// Close this session. @@ -267,31 +257,26 @@ void BasicPublish(string exchange, string routingKey, bool mandatory, /// A message indicating the reason for closing the model /// /// - [AmqpMethodDoNotImplement(null)] void Close(ushort replyCode, string replyText); /// /// Enable publisher acknowledgements. /// - [AmqpMethodDoNotImplement(null)] void ConfirmSelect(); /// /// Creates a BasicPublishBatch instance /// - [AmqpMethodDoNotImplement(null)] IBasicPublishBatch CreateBasicPublishBatch(); /// /// Creates a BasicPublishBatch instance /// - [AmqpMethodDoNotImplement(null)] IBasicPublishBatch CreateBasicPublishBatch(int sizeHint); /// /// Construct a completely empty content header for use with the Basic content class. /// - [AmqpContentHeaderFactory("basic")] IBasicProperties CreateBasicProperties(); /// @@ -301,8 +286,7 @@ void BasicPublish(string exchange, string routingKey, bool mandatory, /// /// Routing key must be shorter than 255 bytes. /// - /// - [AmqpMethodDoNotImplement(null)] + /// void ExchangeBind(string destination, string source, string routingKey, IDictionary arguments); /// @@ -312,25 +296,21 @@ void BasicPublish(string exchange, string routingKey, bool mandatory, /// /// Routing key must be shorter than 255 bytes. /// - /// - void ExchangeBindNoWait(string destination, string source, string routingKey, - IDictionary arguments); + /// + void ExchangeBindNoWait(string destination, string source, string routingKey, IDictionary arguments); /// Declare an exchange. /// /// The exchange is declared non-passive and non-internal. /// The "nowait" option is not exercised. /// - [AmqpMethodDoNotImplement(null)] - void ExchangeDeclare(string exchange, string type, bool durable, bool autoDelete, - IDictionary arguments); + void ExchangeDeclare(string exchange, string type, bool durable, bool autoDelete, IDictionary arguments); /// /// Same as ExchangeDeclare but sets nowait to true and returns void (as there /// will be no response from the server). /// - void ExchangeDeclareNoWait(string exchange, string type, bool durable, bool autoDelete, - IDictionary arguments); + void ExchangeDeclareNoWait(string exchange, string type, bool durable, bool autoDelete, IDictionary arguments); /// /// Do a passive exchange declaration. @@ -341,13 +321,11 @@ void ExchangeDeclareNoWait(string exchange, string type, bool durable, bool auto /// It will do nothing if the exchange already exists and result /// in a channel-level protocol exception (channel closure) if not. /// - [AmqpMethodDoNotImplement(null)] void ExchangeDeclarePassive(string exchange); /// /// Delete an exchange. /// - [AmqpMethodDoNotImplement(null)] void ExchangeDelete(string exchange, bool ifUnused); /// @@ -361,11 +339,7 @@ void ExchangeDeclareNoWait(string exchange, string type, bool durable, bool auto /// /// Routing key must be shorter than 255 bytes. /// - [AmqpMethodDoNotImplement(null)] - void ExchangeUnbind(string destination, - string source, - string routingKey, - IDictionary arguments); + void ExchangeUnbind(string destination, string source, string routingKey, IDictionary arguments); /// /// Like ExchangeUnbind but sets nowait to true. @@ -375,9 +349,7 @@ void ExchangeUnbind(string destination, /// Routing key must be shorter than 255 bytes. /// /// - [AmqpMethodDoNotImplement(null)] - void ExchangeUnbindNoWait(string destination, string source, string routingKey, - IDictionary arguments); + void ExchangeUnbindNoWait(string destination, string source, string routingKey, IDictionary arguments); /// /// Bind a queue to an exchange. @@ -386,8 +358,7 @@ void ExchangeUnbindNoWait(string destination, string source, string routingKey, /// /// Routing key must be shorter than 255 bytes. /// - /// - [AmqpMethodDoNotImplement(null)] + /// void QueueBind(string queue, string exchange, string routingKey, IDictionary arguments); /// Same as QueueBind but sets nowait parameter to true. @@ -395,21 +366,17 @@ void ExchangeUnbindNoWait(string destination, string source, string routingKey, /// /// Routing key must be shorter than 255 bytes. /// - /// + /// void QueueBindNoWait(string queue, string exchange, string routingKey, IDictionary arguments); /// Declare a queue. - [AmqpMethodDoNotImplement(null)] - QueueDeclareOk QueueDeclare(string queue, bool durable, bool exclusive, - bool autoDelete, IDictionary arguments); + QueueDeclareOk QueueDeclare(string queue, bool durable, bool exclusive, bool autoDelete, IDictionary arguments); /// /// Same as QueueDeclare but sets nowait to true and returns void (as there /// will be no response from the server). /// - void QueueDeclareNoWait(string queue, bool durable, - bool exclusive, bool autoDelete, - IDictionary arguments); + void QueueDeclareNoWait(string queue, bool durable, bool exclusive, bool autoDelete, IDictionary arguments); /// Declare a queue passively. /// @@ -417,7 +384,6 @@ void QueueDeclareNoWait(string queue, bool durable, ///non-exclusive, and non-autodelete, with no arguments. ///The queue is declared passively; i.e. only check if it exists. /// - [AmqpMethodDoNotImplement(null)] QueueDeclareOk QueueDeclarePassive(string queue); /// @@ -426,7 +392,6 @@ void QueueDeclareNoWait(string queue, bool durable, /// an exception will be closed with an exception. /// /// The name of the queue - [AmqpMethodDoNotImplement(null)] uint MessageCount(string queue); /// @@ -435,7 +400,6 @@ void QueueDeclareNoWait(string queue, bool durable, /// an exception will be closed with an exception. /// /// The name of the queue - [AmqpMethodDoNotImplement(null)] uint ConsumerCount(string queue); /// @@ -445,7 +409,6 @@ void QueueDeclareNoWait(string queue, bool durable, ///Returns the number of messages purged during queue deletion. /// uint.MaxValue. /// - [AmqpMethodDoNotImplement(null)] uint QueueDelete(string queue, bool ifUnused, bool ifEmpty); /// @@ -460,7 +423,6 @@ void QueueDeclareNoWait(string queue, bool durable, /// /// Returns the number of messages purged. /// - [AmqpMethodDoNotImplement(null)] uint QueuePurge(string queue); /// @@ -470,7 +432,7 @@ void QueueDeclareNoWait(string queue, bool durable, /// /// Routing key must be shorter than 255 bytes. /// - /// + /// void QueueUnbind(string queue, string exchange, string routingKey, IDictionary arguments); /// @@ -496,7 +458,6 @@ void QueueDeclareNoWait(string queue, bool durable, /// all the messages were ack'd (and none were nack'd). Note, /// throws an exception when called on a non-Confirm channel. /// - [AmqpMethodDoNotImplement(null)] bool WaitForConfirms(); /// @@ -512,7 +473,6 @@ void QueueDeclareNoWait(string queue, bool durable, /// all the messages were ack'd (and none were nack'd). Note, /// throws an exception when called on a non-Confirm channel. /// - [AmqpMethodDoNotImplement(null)] bool WaitForConfirms(TimeSpan timeout); /// @@ -531,7 +491,6 @@ void QueueDeclareNoWait(string queue, bool durable, /// all the messages were ack'd (and none were nack'd). Note, /// throws an exception when called on a non-Confirm channel. /// - [AmqpMethodDoNotImplement(null)] bool WaitForConfirms(TimeSpan timeout, out bool timedOut); /// @@ -542,7 +501,6 @@ void QueueDeclareNoWait(string queue, bool durable, /// been ack'd by the broker. If a nack is received, throws an /// OperationInterrupedException exception immediately. /// - [AmqpMethodDoNotImplement(null)] void WaitForConfirmsOrDie(); /// @@ -553,7 +511,6 @@ void QueueDeclareNoWait(string queue, bool durable, /// been ack'd by the broker. If a nack is received or the timeout /// elapses, throws an OperationInterrupedException exception immediately. /// - [AmqpMethodDoNotImplement(null)] void WaitForConfirmsOrDie(TimeSpan timeout); /// diff --git a/projects/RabbitMQ.Client/client/framing/BasicAck.cs b/projects/RabbitMQ.Client/client/framing/BasicAck.cs index 2bf2f79ad2..c6d2e581c8 100644 --- a/projects/RabbitMQ.Client/client/framing/BasicAck.cs +++ b/projects/RabbitMQ.Client/client/framing/BasicAck.cs @@ -29,24 +29,21 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class BasicAck : Client.Impl.MethodBase { public ulong _deliveryTag; public bool _multiple; - ulong DeliveryTag => _deliveryTag; - bool Multiple => _multiple; + public BasicAck() + { + } - public BasicAck() {} - public BasicAck(ulong @DeliveryTag, bool @Multiple) + public BasicAck(ulong DeliveryTag, bool Multiple) { - _deliveryTag = @DeliveryTag; - _multiple = @Multiple; + _deliveryTag = DeliveryTag; + _multiple = Multiple; } public override ushort ProtocolClassId => ClassConstants.Basic; @@ -69,16 +66,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 9; // bytes for _deliveryTag, bit fields - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_deliveryTag).Append(','); - sb.Append(_multiple); - sb.Append(')'); + return 8 + 1; } } } diff --git a/projects/RabbitMQ.Client/client/framing/BasicCancel.cs b/projects/RabbitMQ.Client/client/framing/BasicCancel.cs index a65d4c4f2a..6ac5a5d5bb 100644 --- a/projects/RabbitMQ.Client/client/framing/BasicCancel.cs +++ b/projects/RabbitMQ.Client/client/framing/BasicCancel.cs @@ -33,20 +33,19 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class BasicCancel : Client.Impl.MethodBase { public string _consumerTag; public bool _nowait; - string ConsumerTag => _consumerTag; - bool Nowait => _nowait; + public BasicCancel() + { + } - public BasicCancel() {} - public BasicCancel(string @ConsumerTag, bool @Nowait) + public BasicCancel(string ConsumerTag, bool Nowait) { - _consumerTag = @ConsumerTag; - _nowait = @Nowait; + _consumerTag = ConsumerTag; + _nowait = Nowait; } public override ushort ProtocolClassId => ClassConstants.Basic; @@ -69,17 +68,9 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 2; // bytes for length of _consumerTag, bit fields + int bufferSize = 1 + 1; // bytes for length of _consumerTag, bit fields bufferSize += Encoding.UTF8.GetByteCount(_consumerTag); // _consumerTag in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_consumerTag).Append(','); - sb.Append(_nowait); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/BasicCancelOk.cs b/projects/RabbitMQ.Client/client/framing/BasicCancelOk.cs index 64fc1837e7..4363c1ae5d 100644 --- a/projects/RabbitMQ.Client/client/framing/BasicCancelOk.cs +++ b/projects/RabbitMQ.Client/client/framing/BasicCancelOk.cs @@ -33,17 +33,17 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class BasicCancelOk : Client.Impl.MethodBase { public string _consumerTag; - string ConsumerTag => _consumerTag; + public BasicCancelOk() + { + } - public BasicCancelOk() {} - public BasicCancelOk(string @ConsumerTag) + public BasicCancelOk(string ConsumerTag) { - _consumerTag = @ConsumerTag; + _consumerTag = ConsumerTag; } public override ushort ProtocolClassId => ClassConstants.Basic; @@ -67,12 +67,5 @@ public override int GetRequiredBufferSize() bufferSize += Encoding.UTF8.GetByteCount(_consumerTag); // _consumerTag in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_consumerTag); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/BasicConsume.cs b/projects/RabbitMQ.Client/client/framing/BasicConsume.cs index a1d675e294..a46afd86c4 100644 --- a/projects/RabbitMQ.Client/client/framing/BasicConsume.cs +++ b/projects/RabbitMQ.Client/client/framing/BasicConsume.cs @@ -35,8 +35,7 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. - internal sealed class BasicConsume : Client.Impl.MethodBase + internal sealed class BasicConsume : MethodBase { public ushort _reserved1; public string _queue; @@ -47,26 +46,20 @@ internal sealed class BasicConsume : Client.Impl.MethodBase public bool _nowait; public IDictionary _arguments; - ushort Reserved1 => _reserved1; - string Queue => _queue; - string ConsumerTag => _consumerTag; - bool NoLocal => _noLocal; - bool NoAck => _noAck; - bool Exclusive => _exclusive; - bool Nowait => _nowait; - IDictionary Arguments => _arguments; + public BasicConsume() + { + } - public BasicConsume() {} - public BasicConsume(ushort @Reserved1, string @Queue, string @ConsumerTag, bool @NoLocal, bool @NoAck, bool @Exclusive, bool @Nowait, IDictionary @Arguments) + public BasicConsume(ushort Reserved1, string Queue, string ConsumerTag, bool NoLocal, bool NoAck, bool Exclusive, bool Nowait, IDictionary Arguments) { - _reserved1 = @Reserved1; - _queue = @Queue; - _consumerTag = @ConsumerTag; - _noLocal = @NoLocal; - _noAck = @NoAck; - _exclusive = @Exclusive; - _nowait = @Nowait; - _arguments = @Arguments; + _reserved1 = Reserved1; + _queue = Queue; + _consumerTag = ConsumerTag; + _noLocal = NoLocal; + _noAck = NoAck; + _exclusive = Exclusive; + _nowait = Nowait; + _arguments = Arguments; } public override ushort ProtocolClassId => ClassConstants.Basic; @@ -74,7 +67,7 @@ public BasicConsume(ushort @Reserved1, string @Queue, string @ConsumerTag, bool public override string ProtocolMethodName => "basic.consume"; public override bool HasContent => false; - public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + public override void ReadArgumentsFrom(ref MethodArgumentReader reader) { _reserved1 = reader.ReadShort(); _queue = reader.ReadShortstr(); @@ -86,7 +79,7 @@ public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader read _arguments = reader.ReadTable(); } - public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + public override void WriteArgumentsTo(ref MethodArgumentWriter writer) { writer.WriteShort(_reserved1); writer.WriteShortstr(_queue); @@ -101,25 +94,11 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 5; // bytes for _reserved1, length of _queue, length of _consumerTag, bit fields + int bufferSize = 2 + 1 + 1 + 1; // bytes for _reserved1, length of _queue, length of _consumerTag, bit fields bufferSize += Encoding.UTF8.GetByteCount(_queue); // _queue in bytes bufferSize += Encoding.UTF8.GetByteCount(_consumerTag); // _consumerTag in bytes bufferSize += WireFormatting.GetTableByteCount(_arguments); // _arguments in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_reserved1).Append(','); - sb.Append(_queue).Append(','); - sb.Append(_consumerTag).Append(','); - sb.Append(_noLocal).Append(','); - sb.Append(_noAck).Append(','); - sb.Append(_exclusive).Append(','); - sb.Append(_nowait).Append(','); - sb.Append(_arguments); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/BasicConsumeOk.cs b/projects/RabbitMQ.Client/client/framing/BasicConsumeOk.cs index 3dc82e6068..46c7f50950 100644 --- a/projects/RabbitMQ.Client/client/framing/BasicConsumeOk.cs +++ b/projects/RabbitMQ.Client/client/framing/BasicConsumeOk.cs @@ -33,17 +33,17 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class BasicConsumeOk : Client.Impl.MethodBase { public string _consumerTag; - string ConsumerTag => _consumerTag; + public BasicConsumeOk() + { + } - public BasicConsumeOk() {} - public BasicConsumeOk(string @ConsumerTag) + public BasicConsumeOk(string ConsumerTag) { - _consumerTag = @ConsumerTag; + _consumerTag = ConsumerTag; } public override ushort ProtocolClassId => ClassConstants.Basic; @@ -67,12 +67,5 @@ public override int GetRequiredBufferSize() bufferSize += Encoding.UTF8.GetByteCount(_consumerTag); // _consumerTag in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_consumerTag); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/BasicDeliver.cs b/projects/RabbitMQ.Client/client/framing/BasicDeliver.cs index 5ed57fdd3c..5758a78f78 100644 --- a/projects/RabbitMQ.Client/client/framing/BasicDeliver.cs +++ b/projects/RabbitMQ.Client/client/framing/BasicDeliver.cs @@ -33,7 +33,6 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class BasicDeliver : Client.Impl.MethodBase { public string _consumerTag; @@ -42,20 +41,17 @@ internal sealed class BasicDeliver : Client.Impl.MethodBase public string _exchange; public string _routingKey; - string ConsumerTag => _consumerTag; - ulong DeliveryTag => _deliveryTag; - bool Redelivered => _redelivered; - string Exchange => _exchange; - string RoutingKey => _routingKey; + public BasicDeliver() + { + } - public BasicDeliver() {} - public BasicDeliver(string @ConsumerTag, ulong @DeliveryTag, bool @Redelivered, string @Exchange, string @RoutingKey) + public BasicDeliver(string ConsumerTag, ulong DeliveryTag, bool Redelivered, string Exchange, string RoutingKey) { - _consumerTag = @ConsumerTag; - _deliveryTag = @DeliveryTag; - _redelivered = @Redelivered; - _exchange = @Exchange; - _routingKey = @RoutingKey; + _consumerTag = ConsumerTag; + _deliveryTag = DeliveryTag; + _redelivered = Redelivered; + _exchange = Exchange; + _routingKey = RoutingKey; } public override ushort ProtocolClassId => ClassConstants.Basic; @@ -84,22 +80,11 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 12; // bytes for length of _consumerTag, _deliveryTag, bit fields, length of _exchange, length of _routingKey + int bufferSize = 1 + 8 + 1 + 1 + 1; // bytes for length of _consumerTag, _deliveryTag, bit fields, length of _exchange, length of _routingKey bufferSize += Encoding.UTF8.GetByteCount(_consumerTag); // _consumerTag in bytes bufferSize += Encoding.UTF8.GetByteCount(_exchange); // _exchange in bytes bufferSize += Encoding.UTF8.GetByteCount(_routingKey); // _routingKey in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_consumerTag).Append(','); - sb.Append(_deliveryTag).Append(','); - sb.Append(_redelivered).Append(','); - sb.Append(_exchange).Append(','); - sb.Append(_routingKey); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/BasicGet.cs b/projects/RabbitMQ.Client/client/framing/BasicGet.cs index eb0d1a3f66..e8a2f6e24d 100644 --- a/projects/RabbitMQ.Client/client/framing/BasicGet.cs +++ b/projects/RabbitMQ.Client/client/framing/BasicGet.cs @@ -33,23 +33,21 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class BasicGet : Client.Impl.MethodBase { public ushort _reserved1; public string _queue; public bool _noAck; - ushort Reserved1 => _reserved1; - string Queue => _queue; - bool NoAck => _noAck; + public BasicGet() + { + } - public BasicGet() {} - public BasicGet(ushort @Reserved1, string @Queue, bool @NoAck) + public BasicGet(ushort Reserved1, string Queue, bool NoAck) { - _reserved1 = @Reserved1; - _queue = @Queue; - _noAck = @NoAck; + _reserved1 = Reserved1; + _queue = Queue; + _noAck = NoAck; } public override ushort ProtocolClassId => ClassConstants.Basic; @@ -74,18 +72,9 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 4; // bytes for _reserved1, length of _queue, bit fields + int bufferSize = 2 + 1 + 1; // bytes for _reserved1, length of _queue, bit fields bufferSize += Encoding.UTF8.GetByteCount(_queue); // _queue in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_reserved1).Append(','); - sb.Append(_queue).Append(','); - sb.Append(_noAck); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/BasicGetEmpty.cs b/projects/RabbitMQ.Client/client/framing/BasicGetEmpty.cs index 3d7379f4e1..089253c0ee 100644 --- a/projects/RabbitMQ.Client/client/framing/BasicGetEmpty.cs +++ b/projects/RabbitMQ.Client/client/framing/BasicGetEmpty.cs @@ -33,17 +33,17 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class BasicGetEmpty : Client.Impl.MethodBase { public string _reserved1; - string Reserved1 => _reserved1; + public BasicGetEmpty() + { + } - public BasicGetEmpty() {} - public BasicGetEmpty(string @Reserved1) + public BasicGetEmpty(string Reserved1) { - _reserved1 = @Reserved1; + _reserved1 = Reserved1; } public override ushort ProtocolClassId => ClassConstants.Basic; @@ -67,12 +67,5 @@ public override int GetRequiredBufferSize() bufferSize += Encoding.UTF8.GetByteCount(_reserved1); // _reserved1 in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_reserved1); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/BasicGetOk.cs b/projects/RabbitMQ.Client/client/framing/BasicGetOk.cs index e961483453..9523206da7 100644 --- a/projects/RabbitMQ.Client/client/framing/BasicGetOk.cs +++ b/projects/RabbitMQ.Client/client/framing/BasicGetOk.cs @@ -33,7 +33,6 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class BasicGetOk : Client.Impl.MethodBase { public ulong _deliveryTag; @@ -42,20 +41,17 @@ internal sealed class BasicGetOk : Client.Impl.MethodBase public string _routingKey; public uint _messageCount; - ulong DeliveryTag => _deliveryTag; - bool Redelivered => _redelivered; - string Exchange => _exchange; - string RoutingKey => _routingKey; - uint MessageCount => _messageCount; + public BasicGetOk() + { + } - public BasicGetOk() {} - public BasicGetOk(ulong @DeliveryTag, bool @Redelivered, string @Exchange, string @RoutingKey, uint @MessageCount) + public BasicGetOk(ulong DeliveryTag, bool Redelivered, string Exchange, string RoutingKey, uint MessageCount) { - _deliveryTag = @DeliveryTag; - _redelivered = @Redelivered; - _exchange = @Exchange; - _routingKey = @RoutingKey; - _messageCount = @MessageCount; + _deliveryTag = DeliveryTag; + _redelivered = Redelivered; + _exchange = Exchange; + _routingKey = RoutingKey; + _messageCount = MessageCount; } public override ushort ProtocolClassId => ClassConstants.Basic; @@ -84,21 +80,10 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 15; // bytes for _deliveryTag, bit fields, length of _exchange, length of _routingKey, _messageCount + int bufferSize = 8 + 1 + 1 + 1 + 4; // bytes for _deliveryTag, bit fields, length of _exchange, length of _routingKey, _messageCount bufferSize += Encoding.UTF8.GetByteCount(_exchange); // _exchange in bytes bufferSize += Encoding.UTF8.GetByteCount(_routingKey); // _routingKey in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_deliveryTag).Append(','); - sb.Append(_redelivered).Append(','); - sb.Append(_exchange).Append(','); - sb.Append(_routingKey).Append(','); - sb.Append(_messageCount); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/BasicNack.cs b/projects/RabbitMQ.Client/client/framing/BasicNack.cs index 2e819095a6..cfe44251fa 100644 --- a/projects/RabbitMQ.Client/client/framing/BasicNack.cs +++ b/projects/RabbitMQ.Client/client/framing/BasicNack.cs @@ -29,27 +29,23 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class BasicNack : Client.Impl.MethodBase { public ulong _deliveryTag; public bool _multiple; public bool _requeue; - ulong DeliveryTag => _deliveryTag; - bool Multiple => _multiple; - bool Requeue => _requeue; + public BasicNack() + { + } - public BasicNack() {} - public BasicNack(ulong @DeliveryTag, bool @Multiple, bool @Requeue) + public BasicNack(ulong DeliveryTag, bool Multiple, bool Requeue) { - _deliveryTag = @DeliveryTag; - _multiple = @Multiple; - _requeue = @Requeue; + _deliveryTag = DeliveryTag; + _multiple = Multiple; + _requeue = Requeue; } public override ushort ProtocolClassId => ClassConstants.Basic; @@ -74,17 +70,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 9; // bytes for _deliveryTag, bit fields - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_deliveryTag).Append(','); - sb.Append(_multiple).Append(','); - sb.Append(_requeue); - sb.Append(')'); + return 8 + 1; // bytes for _deliveryTag, bit fields } } } diff --git a/projects/RabbitMQ.Client/client/framing/BasicProperties.cs b/projects/RabbitMQ.Client/client/framing/BasicProperties.cs index cf37d83dc3..702cbb47ac 100644 --- a/projects/RabbitMQ.Client/client/framing/BasicProperties.cs +++ b/projects/RabbitMQ.Client/client/framing/BasicProperties.cs @@ -193,11 +193,14 @@ public override string ClusterId public override bool IsClusterIdPresent() => _clusterId != default; - public BasicProperties() { } + public BasicProperties() + { + } + public override ushort ProtocolClassId => 60; public override string ProtocolClassName => "basic"; - internal override void ReadPropertiesFrom(ref Client.Impl.ContentHeaderPropertyReader reader) + internal override void ReadPropertiesFrom(ref ContentHeaderPropertyReader reader) { var contentType_present = reader.ReadPresence(); var contentEncoding_present = reader.ReadPresence(); @@ -230,7 +233,7 @@ internal override void ReadPropertiesFrom(ref Client.Impl.ContentHeaderPropertyR if (clusterId_present) { _clusterId = reader.ReadShortstr(); } } - internal override void WritePropertiesTo(ref Client.Impl.ContentHeaderPropertyWriter writer) + internal override void WritePropertiesTo(ref ContentHeaderPropertyWriter writer) { writer.WritePresence(IsContentTypePresent()); writer.WritePresence(IsContentEncodingPresent()); @@ -282,25 +285,5 @@ public override int GetRequiredPayloadBufferSize() if (IsClusterIdPresent()) { bufferSize += 1 + Encoding.UTF8.GetByteCount(_clusterId); } // _clusterId in bytes return bufferSize; } - - public override void AppendPropertyDebugStringTo(StringBuilder sb) - { - sb.Append("("); - sb.Append("content-type=").Append(IsContentTypePresent() ? _contentType.ToString() : "_").Append(", "); - sb.Append("content-encoding=").Append(IsContentEncodingPresent() ? _contentEncoding.ToString() : "_").Append(", "); - sb.Append("headers=").Append(IsHeadersPresent() ? _headers.ToString() : "_").Append(", "); - sb.Append("delivery-mode=").Append(IsDeliveryModePresent() ? _deliveryMode.ToString() : "_").Append(", "); - sb.Append("priority=").Append(IsPriorityPresent() ? _priority.ToString() : "_").Append(", "); - sb.Append("correlation-id=").Append(IsCorrelationIdPresent() ? _correlationId.ToString() : "_").Append(", "); - sb.Append("reply-to=").Append(IsReplyToPresent() ? _replyTo.ToString() : "_").Append(", "); - sb.Append("expiration=").Append(IsExpirationPresent() ? _expiration.ToString() : "_").Append(", "); - sb.Append("message-id=").Append(IsMessageIdPresent() ? _messageId.ToString() : "_").Append(", "); - sb.Append("timestamp=").Append(IsTimestampPresent() ? _timestamp.ToString() : "_").Append(", "); - sb.Append("type=").Append(IsTypePresent() ? _type.ToString() : "_").Append(", "); - sb.Append("user-id=").Append(IsUserIdPresent() ? _userId.ToString() : "_").Append(", "); - sb.Append("app-id=").Append(IsAppIdPresent() ? _appId.ToString() : "_").Append(", "); - sb.Append("cluster-id=").Append(IsClusterIdPresent() ? _clusterId.ToString() : "_"); - sb.Append(")"); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/BasicPublish.cs b/projects/RabbitMQ.Client/client/framing/BasicPublish.cs index 35711bd12f..e7a0f949c4 100644 --- a/projects/RabbitMQ.Client/client/framing/BasicPublish.cs +++ b/projects/RabbitMQ.Client/client/framing/BasicPublish.cs @@ -33,7 +33,6 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class BasicPublish : Client.Impl.MethodBase { public ushort _reserved1; @@ -42,20 +41,17 @@ internal sealed class BasicPublish : Client.Impl.MethodBase public bool _mandatory; public bool _immediate; - ushort Reserved1 => _reserved1; - string Exchange => _exchange; - string RoutingKey => _routingKey; - bool Mandatory => _mandatory; - bool Immediate => _immediate; + public BasicPublish() + { + } - public BasicPublish() {} - public BasicPublish(ushort @Reserved1, string @Exchange, string @RoutingKey, bool @Mandatory, bool @Immediate) + public BasicPublish(ushort Reserved1, string Exchange, string RoutingKey, bool Mandatory, bool Immediate) { - _reserved1 = @Reserved1; - _exchange = @Exchange; - _routingKey = @RoutingKey; - _mandatory = @Mandatory; - _immediate = @Immediate; + _reserved1 = Reserved1; + _exchange = Exchange; + _routingKey = RoutingKey; + _mandatory = Mandatory; + _immediate = Immediate; } public override ushort ProtocolClassId => ClassConstants.Basic; @@ -84,21 +80,10 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 5; // bytes for _reserved1, length of _exchange, length of _routingKey, bit fields + int bufferSize = 2 + 1 + 1 + 1; // bytes for _reserved1, length of _exchange, length of _routingKey, bit fields bufferSize += Encoding.UTF8.GetByteCount(_exchange); // _exchange in bytes bufferSize += Encoding.UTF8.GetByteCount(_routingKey); // _routingKey in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_reserved1).Append(','); - sb.Append(_exchange).Append(','); - sb.Append(_routingKey).Append(','); - sb.Append(_mandatory).Append(','); - sb.Append(_immediate); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/BasicQos.cs b/projects/RabbitMQ.Client/client/framing/BasicQos.cs index cf70ee8439..f90b7da81e 100644 --- a/projects/RabbitMQ.Client/client/framing/BasicQos.cs +++ b/projects/RabbitMQ.Client/client/framing/BasicQos.cs @@ -29,27 +29,23 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class BasicQos : Client.Impl.MethodBase { public uint _prefetchSize; public ushort _prefetchCount; public bool _global; - uint PrefetchSize => _prefetchSize; - ushort PrefetchCount => _prefetchCount; - bool Global => _global; + public BasicQos() + { + } - public BasicQos() {} - public BasicQos(uint @PrefetchSize, ushort @PrefetchCount, bool @Global) + public BasicQos(uint PrefetchSize, ushort PrefetchCount, bool Global) { - _prefetchSize = @PrefetchSize; - _prefetchCount = @PrefetchCount; - _global = @Global; + _prefetchSize = PrefetchSize; + _prefetchCount = PrefetchCount; + _global = Global; } public override ushort ProtocolClassId => ClassConstants.Basic; @@ -74,17 +70,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 7; // bytes for _prefetchSize, _prefetchCount, bit fields - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_prefetchSize).Append(','); - sb.Append(_prefetchCount).Append(','); - sb.Append(_global); - sb.Append(')'); + return 4 + 2 + 1; // bytes for _prefetchSize, _prefetchCount, bit fields } } } diff --git a/projects/RabbitMQ.Client/client/framing/BasicQosOk.cs b/projects/RabbitMQ.Client/client/framing/BasicQosOk.cs index 14af3430ba..14f8404453 100644 --- a/projects/RabbitMQ.Client/client/framing/BasicQosOk.cs +++ b/projects/RabbitMQ.Client/client/framing/BasicQosOk.cs @@ -29,15 +29,10 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class BasicQosOk : Client.Impl.MethodBase { - - public BasicQosOk() { } @@ -57,14 +52,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 0; - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(')'); + return 0; } } } diff --git a/projects/RabbitMQ.Client/client/framing/BasicRecover.cs b/projects/RabbitMQ.Client/client/framing/BasicRecover.cs index 0e6d7faadb..bd764e9c91 100644 --- a/projects/RabbitMQ.Client/client/framing/BasicRecover.cs +++ b/projects/RabbitMQ.Client/client/framing/BasicRecover.cs @@ -29,21 +29,19 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class BasicRecover : Client.Impl.MethodBase { public bool _requeue; - bool Requeue => _requeue; + public BasicRecover() + { + } - public BasicRecover() {} - public BasicRecover(bool @Requeue) + public BasicRecover(bool Requeue) { - _requeue = @Requeue; + _requeue = Requeue; } public override ushort ProtocolClassId => ClassConstants.Basic; @@ -64,15 +62,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 1; // bytes for bit fields - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_requeue); - sb.Append(')'); + return 1; // bytes for bit fields } } } diff --git a/projects/RabbitMQ.Client/client/framing/BasicRecoverAsync.cs b/projects/RabbitMQ.Client/client/framing/BasicRecoverAsync.cs index bf8df13296..2fba723682 100644 --- a/projects/RabbitMQ.Client/client/framing/BasicRecoverAsync.cs +++ b/projects/RabbitMQ.Client/client/framing/BasicRecoverAsync.cs @@ -29,21 +29,19 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class BasicRecoverAsync : Client.Impl.MethodBase { public bool _requeue; - bool Requeue => _requeue; + public BasicRecoverAsync() + { + } - public BasicRecoverAsync() {} - public BasicRecoverAsync(bool @Requeue) + public BasicRecoverAsync(bool Requeue) { - _requeue = @Requeue; + _requeue = Requeue; } public override ushort ProtocolClassId => ClassConstants.Basic; @@ -64,15 +62,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 1; // bytes for bit fields - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_requeue); - sb.Append(')'); + return 1; // bytes for bit fields } } } diff --git a/projects/RabbitMQ.Client/client/framing/BasicRecoverOk.cs b/projects/RabbitMQ.Client/client/framing/BasicRecoverOk.cs index 8fbfd3c217..a2c104bbe1 100644 --- a/projects/RabbitMQ.Client/client/framing/BasicRecoverOk.cs +++ b/projects/RabbitMQ.Client/client/framing/BasicRecoverOk.cs @@ -29,15 +29,10 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class BasicRecoverOk : Client.Impl.MethodBase { - - public BasicRecoverOk() { } @@ -57,14 +52,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 0; - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(')'); + return 0; } } } diff --git a/projects/RabbitMQ.Client/client/framing/BasicReject.cs b/projects/RabbitMQ.Client/client/framing/BasicReject.cs index 342389eff2..e02e4551c0 100644 --- a/projects/RabbitMQ.Client/client/framing/BasicReject.cs +++ b/projects/RabbitMQ.Client/client/framing/BasicReject.cs @@ -29,24 +29,21 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class BasicReject : Client.Impl.MethodBase { public ulong _deliveryTag; public bool _requeue; - ulong DeliveryTag => _deliveryTag; - bool Requeue => _requeue; + public BasicReject() + { + } - public BasicReject() {} - public BasicReject(ulong @DeliveryTag, bool @Requeue) + public BasicReject(ulong DeliveryTag, bool Requeue) { - _deliveryTag = @DeliveryTag; - _requeue = @Requeue; + _deliveryTag = DeliveryTag; + _requeue = Requeue; } public override ushort ProtocolClassId => ClassConstants.Basic; @@ -69,16 +66,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 9; // bytes for _deliveryTag, bit fields - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_deliveryTag).Append(','); - sb.Append(_requeue); - sb.Append(')'); + return 8 + 1; // bytes for _deliveryTag, bit fields } } } diff --git a/projects/RabbitMQ.Client/client/framing/BasicReturn.cs b/projects/RabbitMQ.Client/client/framing/BasicReturn.cs index e2b25524d4..c271d88bad 100644 --- a/projects/RabbitMQ.Client/client/framing/BasicReturn.cs +++ b/projects/RabbitMQ.Client/client/framing/BasicReturn.cs @@ -33,7 +33,6 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class BasicReturn : Client.Impl.MethodBase { public ushort _replyCode; @@ -41,18 +40,16 @@ internal sealed class BasicReturn : Client.Impl.MethodBase public string _exchange; public string _routingKey; - ushort ReplyCode => _replyCode; - string ReplyText => _replyText; - string Exchange => _exchange; - string RoutingKey => _routingKey; + public BasicReturn() + { + } - public BasicReturn() {} - public BasicReturn(ushort @ReplyCode, string @ReplyText, string @Exchange, string @RoutingKey) + public BasicReturn(ushort ReplyCode, string ReplyText, string Exchange, string RoutingKey) { - _replyCode = @ReplyCode; - _replyText = @ReplyText; - _exchange = @Exchange; - _routingKey = @RoutingKey; + _replyCode = ReplyCode; + _replyText = ReplyText; + _exchange = Exchange; + _routingKey = RoutingKey; } public override ushort ProtocolClassId => ClassConstants.Basic; @@ -78,21 +75,11 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 5; // bytes for _replyCode, length of _replyText, length of _exchange, length of _routingKey + int bufferSize = 2 + 1 + 1 + 1; // bytes for _replyCode, length of _replyText, length of _exchange, length of _routingKey bufferSize += Encoding.UTF8.GetByteCount(_replyText); // _replyText in bytes bufferSize += Encoding.UTF8.GetByteCount(_exchange); // _exchange in bytes bufferSize += Encoding.UTF8.GetByteCount(_routingKey); // _routingKey in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_replyCode).Append(','); - sb.Append(_replyText).Append(','); - sb.Append(_exchange).Append(','); - sb.Append(_routingKey); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/ChannelClose.cs b/projects/RabbitMQ.Client/client/framing/ChannelClose.cs index cea1403759..8c82a16e62 100644 --- a/projects/RabbitMQ.Client/client/framing/ChannelClose.cs +++ b/projects/RabbitMQ.Client/client/framing/ChannelClose.cs @@ -33,7 +33,6 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class ChannelClose : Client.Impl.MethodBase { public ushort _replyCode; @@ -41,18 +40,16 @@ internal sealed class ChannelClose : Client.Impl.MethodBase public ushort _classId; public ushort _methodId; - ushort ReplyCode => _replyCode; - string ReplyText => _replyText; - ushort ClassId => _classId; - ushort MethodId => _methodId; + public ChannelClose() + { + } - public ChannelClose() {} - public ChannelClose(ushort @ReplyCode, string @ReplyText, ushort @ClassId, ushort @MethodId) + public ChannelClose(ushort ReplyCode, string ReplyText, ushort ClassId, ushort MethodId) { - _replyCode = @ReplyCode; - _replyText = @ReplyText; - _classId = @ClassId; - _methodId = @MethodId; + _replyCode = ReplyCode; + _replyText = ReplyText; + _classId = ClassId; + _methodId = MethodId; } public override ushort ProtocolClassId => ClassConstants.Channel; @@ -78,19 +75,9 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 7; // bytes for _replyCode, length of _replyText, _classId, _methodId + int bufferSize = 2 + 1 + 2 + 2; // bytes for _replyCode, length of _replyText, _classId, _methodId bufferSize += Encoding.UTF8.GetByteCount(_replyText); // _replyText in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_replyCode).Append(','); - sb.Append(_replyText).Append(','); - sb.Append(_classId).Append(','); - sb.Append(_methodId); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/ChannelCloseOk.cs b/projects/RabbitMQ.Client/client/framing/ChannelCloseOk.cs index ea700e135f..1dc5601b9d 100644 --- a/projects/RabbitMQ.Client/client/framing/ChannelCloseOk.cs +++ b/projects/RabbitMQ.Client/client/framing/ChannelCloseOk.cs @@ -29,15 +29,10 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class ChannelCloseOk : Client.Impl.MethodBase { - - public ChannelCloseOk() { } @@ -57,14 +52,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 0; - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(')'); + return 0; } } } diff --git a/projects/RabbitMQ.Client/client/framing/ChannelFlow.cs b/projects/RabbitMQ.Client/client/framing/ChannelFlow.cs index 6745954737..7d92c2d1eb 100644 --- a/projects/RabbitMQ.Client/client/framing/ChannelFlow.cs +++ b/projects/RabbitMQ.Client/client/framing/ChannelFlow.cs @@ -29,21 +29,19 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class ChannelFlow : Client.Impl.MethodBase { public bool _active; - bool Active => _active; + public ChannelFlow() + { + } - public ChannelFlow() {} - public ChannelFlow(bool @Active) + public ChannelFlow(bool Active) { - _active = @Active; + _active = Active; } public override ushort ProtocolClassId => ClassConstants.Channel; @@ -64,15 +62,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 1; // bytes for bit fields - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_active); - sb.Append(')'); + return 1; // bytes for bit fields } } } diff --git a/projects/RabbitMQ.Client/client/framing/ChannelFlowOk.cs b/projects/RabbitMQ.Client/client/framing/ChannelFlowOk.cs index 10daf231e0..2a98104ad6 100644 --- a/projects/RabbitMQ.Client/client/framing/ChannelFlowOk.cs +++ b/projects/RabbitMQ.Client/client/framing/ChannelFlowOk.cs @@ -29,21 +29,19 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class ChannelFlowOk : Client.Impl.MethodBase { public bool _active; - bool Active => _active; + public ChannelFlowOk() + { + } - public ChannelFlowOk() {} - public ChannelFlowOk(bool @Active) + public ChannelFlowOk(bool Active) { - _active = @Active; + _active = Active; } public override ushort ProtocolClassId => ClassConstants.Channel; @@ -67,12 +65,5 @@ public override int GetRequiredBufferSize() int bufferSize = 1; // bytes for bit fields return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_active); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/ChannelOpen.cs b/projects/RabbitMQ.Client/client/framing/ChannelOpen.cs index c1ed42be2e..45165638bd 100644 --- a/projects/RabbitMQ.Client/client/framing/ChannelOpen.cs +++ b/projects/RabbitMQ.Client/client/framing/ChannelOpen.cs @@ -33,17 +33,17 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class ChannelOpen : Client.Impl.MethodBase { public string _reserved1; - string Reserved1 => _reserved1; + public ChannelOpen() + { + } - public ChannelOpen() {} - public ChannelOpen(string @Reserved1) + public ChannelOpen(string Reserved1) { - _reserved1 = @Reserved1; + _reserved1 = Reserved1; } public override ushort ProtocolClassId => ClassConstants.Channel; @@ -67,12 +67,5 @@ public override int GetRequiredBufferSize() bufferSize += Encoding.UTF8.GetByteCount(_reserved1); // _reserved1 in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_reserved1); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/ChannelOpenOk.cs b/projects/RabbitMQ.Client/client/framing/ChannelOpenOk.cs index 7053e5122b..464a140059 100644 --- a/projects/RabbitMQ.Client/client/framing/ChannelOpenOk.cs +++ b/projects/RabbitMQ.Client/client/framing/ChannelOpenOk.cs @@ -29,21 +29,19 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class ChannelOpenOk : Client.Impl.MethodBase { public byte[] _reserved1; - byte[] Reserved1 => _reserved1; + public ChannelOpenOk() + { + } - public ChannelOpenOk() {} - public ChannelOpenOk(byte[] @Reserved1) + public ChannelOpenOk(byte[] Reserved1) { - _reserved1 = @Reserved1; + _reserved1 = Reserved1; } public override ushort ProtocolClassId => ClassConstants.Channel; @@ -67,12 +65,5 @@ public override int GetRequiredBufferSize() bufferSize += _reserved1.Length; // _reserved1 in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_reserved1); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/ConfirmSelect.cs b/projects/RabbitMQ.Client/client/framing/ConfirmSelect.cs index 44ec954509..a7af79ee48 100644 --- a/projects/RabbitMQ.Client/client/framing/ConfirmSelect.cs +++ b/projects/RabbitMQ.Client/client/framing/ConfirmSelect.cs @@ -29,21 +29,19 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class ConfirmSelect : Client.Impl.MethodBase { public bool _nowait; - bool Nowait => _nowait; + public ConfirmSelect() + { + } - public ConfirmSelect() {} - public ConfirmSelect(bool @Nowait) + public ConfirmSelect(bool Nowait) { - _nowait = @Nowait; + _nowait = Nowait; } public override ushort ProtocolClassId => ClassConstants.Confirm; @@ -64,15 +62,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 1; // bytes for bit fields - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_nowait); - sb.Append(')'); + return 1; // bytes for bit fields } } } diff --git a/projects/RabbitMQ.Client/client/framing/ConfirmSelectOk.cs b/projects/RabbitMQ.Client/client/framing/ConfirmSelectOk.cs index b88298c6dd..52b058d676 100644 --- a/projects/RabbitMQ.Client/client/framing/ConfirmSelectOk.cs +++ b/projects/RabbitMQ.Client/client/framing/ConfirmSelectOk.cs @@ -29,15 +29,10 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class ConfirmSelectOk : Client.Impl.MethodBase { - - public ConfirmSelectOk() { } @@ -57,14 +52,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 0; - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(')'); + return 0; } } } diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionBlocked.cs b/projects/RabbitMQ.Client/client/framing/ConnectionBlocked.cs index 7322fb8113..2517eced59 100644 --- a/projects/RabbitMQ.Client/client/framing/ConnectionBlocked.cs +++ b/projects/RabbitMQ.Client/client/framing/ConnectionBlocked.cs @@ -33,17 +33,17 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class ConnectionBlocked : Client.Impl.MethodBase { public string _reason; - string Reason => _reason; + public ConnectionBlocked() + { + } - public ConnectionBlocked() {} - public ConnectionBlocked(string @Reason) + public ConnectionBlocked(string Reason) { - _reason = @Reason; + _reason = Reason; } public override ushort ProtocolClassId => ClassConstants.Connection; @@ -67,12 +67,5 @@ public override int GetRequiredBufferSize() bufferSize += Encoding.UTF8.GetByteCount(_reason); // _reason in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_reason); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionClose.cs b/projects/RabbitMQ.Client/client/framing/ConnectionClose.cs index 24238c3105..de431d5b82 100644 --- a/projects/RabbitMQ.Client/client/framing/ConnectionClose.cs +++ b/projects/RabbitMQ.Client/client/framing/ConnectionClose.cs @@ -33,7 +33,6 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class ConnectionClose : Client.Impl.MethodBase { public ushort _replyCode; @@ -41,18 +40,16 @@ internal sealed class ConnectionClose : Client.Impl.MethodBase public ushort _classId; public ushort _methodId; - ushort ReplyCode => _replyCode; - string ReplyText => _replyText; - ushort ClassId => _classId; - ushort MethodId => _methodId; + public ConnectionClose() + { + } - public ConnectionClose() {} - public ConnectionClose(ushort @ReplyCode, string @ReplyText, ushort @ClassId, ushort @MethodId) + public ConnectionClose(ushort ReplyCode, string ReplyText, ushort ClassId, ushort MethodId) { - _replyCode = @ReplyCode; - _replyText = @ReplyText; - _classId = @ClassId; - _methodId = @MethodId; + _replyCode = ReplyCode; + _replyText = ReplyText; + _classId = ClassId; + _methodId = MethodId; } public override ushort ProtocolClassId => ClassConstants.Connection; @@ -78,19 +75,9 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 7; // bytes for _replyCode, length of _replyText, _classId, _methodId + int bufferSize = 2 + 1 + 2 + 2; // bytes for _replyCode, length of _replyText, _classId, _methodId bufferSize += Encoding.UTF8.GetByteCount(_replyText); // _replyText in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_replyCode).Append(','); - sb.Append(_replyText).Append(','); - sb.Append(_classId).Append(','); - sb.Append(_methodId); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionCloseOk.cs b/projects/RabbitMQ.Client/client/framing/ConnectionCloseOk.cs index 32617b1780..617761e07c 100644 --- a/projects/RabbitMQ.Client/client/framing/ConnectionCloseOk.cs +++ b/projects/RabbitMQ.Client/client/framing/ConnectionCloseOk.cs @@ -29,15 +29,10 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class ConnectionCloseOk : Client.Impl.MethodBase { - - public ConnectionCloseOk() { } @@ -57,14 +52,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 0; - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(')'); + return 0; } } } diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionOpen.cs b/projects/RabbitMQ.Client/client/framing/ConnectionOpen.cs index acc6434d33..0c755d71d6 100644 --- a/projects/RabbitMQ.Client/client/framing/ConnectionOpen.cs +++ b/projects/RabbitMQ.Client/client/framing/ConnectionOpen.cs @@ -33,23 +33,21 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class ConnectionOpen : Client.Impl.MethodBase { public string _virtualHost; public string _reserved1; public bool _reserved2; - string VirtualHost => _virtualHost; - string Reserved1 => _reserved1; - bool Reserved2 => _reserved2; + public ConnectionOpen() + { + } - public ConnectionOpen() {} - public ConnectionOpen(string @VirtualHost, string @Reserved1, bool @Reserved2) + public ConnectionOpen(string VirtualHost, string Reserved1, bool Reserved2) { - _virtualHost = @VirtualHost; - _reserved1 = @Reserved1; - _reserved2 = @Reserved2; + _virtualHost = VirtualHost; + _reserved1 = Reserved1; + _reserved2 = Reserved2; } public override ushort ProtocolClassId => ClassConstants.Connection; @@ -74,19 +72,10 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 3; // bytes for length of _virtualHost, length of _reserved1, bit fields + int bufferSize = 1 + 1 + 1; // bytes for length of _virtualHost, length of _reserved1, bit fields bufferSize += Encoding.UTF8.GetByteCount(_virtualHost); // _virtualHost in bytes bufferSize += Encoding.UTF8.GetByteCount(_reserved1); // _reserved1 in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_virtualHost).Append(','); - sb.Append(_reserved1).Append(','); - sb.Append(_reserved2); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionOpenOk.cs b/projects/RabbitMQ.Client/client/framing/ConnectionOpenOk.cs index c223b109d9..779a8c8254 100644 --- a/projects/RabbitMQ.Client/client/framing/ConnectionOpenOk.cs +++ b/projects/RabbitMQ.Client/client/framing/ConnectionOpenOk.cs @@ -33,17 +33,17 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class ConnectionOpenOk : Client.Impl.MethodBase { public string _reserved1; - string Reserved1 => _reserved1; + public ConnectionOpenOk() + { + } - public ConnectionOpenOk() {} - public ConnectionOpenOk(string @Reserved1) + public ConnectionOpenOk(string Reserved1) { - _reserved1 = @Reserved1; + _reserved1 = Reserved1; } public override ushort ProtocolClassId => ClassConstants.Connection; @@ -67,12 +67,5 @@ public override int GetRequiredBufferSize() bufferSize += Encoding.UTF8.GetByteCount(_reserved1); // _reserved1 in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_reserved1); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionSecure.cs b/projects/RabbitMQ.Client/client/framing/ConnectionSecure.cs index 0b7f69095a..a70edebd9f 100644 --- a/projects/RabbitMQ.Client/client/framing/ConnectionSecure.cs +++ b/projects/RabbitMQ.Client/client/framing/ConnectionSecure.cs @@ -29,21 +29,19 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class ConnectionSecure : Client.Impl.MethodBase { public byte[] _challenge; - byte[] Challenge => _challenge; + public ConnectionSecure() + { + } - public ConnectionSecure() {} - public ConnectionSecure(byte[] @Challenge) + public ConnectionSecure(byte[] Challenge) { - _challenge = @Challenge; + _challenge = Challenge; } public override ushort ProtocolClassId => ClassConstants.Connection; @@ -67,12 +65,5 @@ public override int GetRequiredBufferSize() bufferSize += _challenge.Length; // _challenge in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_challenge); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionSecureOk.cs b/projects/RabbitMQ.Client/client/framing/ConnectionSecureOk.cs index 3f5e1fc4d8..21d39e4b40 100644 --- a/projects/RabbitMQ.Client/client/framing/ConnectionSecureOk.cs +++ b/projects/RabbitMQ.Client/client/framing/ConnectionSecureOk.cs @@ -29,21 +29,19 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class ConnectionSecureOk : Client.Impl.MethodBase { public byte[] _response; - byte[] Response => _response; + public ConnectionSecureOk() + { + } - public ConnectionSecureOk() {} - public ConnectionSecureOk(byte[] @Response) + public ConnectionSecureOk(byte[] Response) { - _response = @Response; + _response = Response; } public override ushort ProtocolClassId => ClassConstants.Connection; @@ -67,12 +65,5 @@ public override int GetRequiredBufferSize() bufferSize += _response.Length; // _response in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_response); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionStart.cs b/projects/RabbitMQ.Client/client/framing/ConnectionStart.cs index 88da644b0b..4b44fa9002 100644 --- a/projects/RabbitMQ.Client/client/framing/ConnectionStart.cs +++ b/projects/RabbitMQ.Client/client/framing/ConnectionStart.cs @@ -30,13 +30,11 @@ //--------------------------------------------------------------------------- using System.Collections.Generic; -using System.Text; using RabbitMQ.Client.Impl; namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. - internal sealed class ConnectionStart : Client.Impl.MethodBase + internal sealed class ConnectionStart : MethodBase { public byte _versionMajor; public byte _versionMinor; @@ -44,20 +42,17 @@ internal sealed class ConnectionStart : Client.Impl.MethodBase public byte[] _mechanisms; public byte[] _locales; - byte VersionMajor => _versionMajor; - byte VersionMinor => _versionMinor; - IDictionary ServerProperties => _serverProperties; - byte[] Mechanisms => _mechanisms; - byte[] Locales => _locales; + public ConnectionStart() + { + } - public ConnectionStart() {} - public ConnectionStart(byte @VersionMajor, byte @VersionMinor, IDictionary @ServerProperties, byte[] @Mechanisms, byte[] @Locales) + public ConnectionStart(byte VersionMajor, byte VersionMinor, IDictionary ServerProperties, byte[] Mechanisms, byte[] Locales) { - _versionMajor = @VersionMajor; - _versionMinor = @VersionMinor; - _serverProperties = @ServerProperties; - _mechanisms = @Mechanisms; - _locales = @Locales; + _versionMajor = VersionMajor; + _versionMinor = VersionMinor; + _serverProperties = ServerProperties; + _mechanisms = Mechanisms; + _locales = Locales; } public override ushort ProtocolClassId => ClassConstants.Connection; @@ -65,7 +60,7 @@ public ConnectionStart(byte @VersionMajor, byte @VersionMinor, IDictionary "connection.start"; public override bool HasContent => false; - public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + public override void ReadArgumentsFrom(ref MethodArgumentReader reader) { _versionMajor = reader.ReadOctet(); _versionMinor = reader.ReadOctet(); @@ -74,7 +69,7 @@ public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader read _locales = reader.ReadLongstr(); } - public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + public override void WriteArgumentsTo(ref MethodArgumentWriter writer) { writer.WriteOctet(_versionMajor); writer.WriteOctet(_versionMinor); @@ -85,22 +80,11 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 10; // bytes for _versionMajor, _versionMinor, length of _mechanisms, length of _locales + int bufferSize = 1 + 1 + 4 + 4; // bytes for _versionMajor, _versionMinor, length of _mechanisms, length of _locales bufferSize += WireFormatting.GetTableByteCount(_serverProperties); // _serverProperties in bytes bufferSize += _mechanisms.Length; // _mechanisms in bytes bufferSize += _locales.Length; // _locales in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_versionMajor).Append(','); - sb.Append(_versionMinor).Append(','); - sb.Append(_serverProperties).Append(','); - sb.Append(_mechanisms).Append(','); - sb.Append(_locales); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionStartOk.cs b/projects/RabbitMQ.Client/client/framing/ConnectionStartOk.cs index ec385ed58e..7e7729217d 100644 --- a/projects/RabbitMQ.Client/client/framing/ConnectionStartOk.cs +++ b/projects/RabbitMQ.Client/client/framing/ConnectionStartOk.cs @@ -35,26 +35,23 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. - internal sealed class ConnectionStartOk : Client.Impl.MethodBase + internal sealed class ConnectionStartOk : MethodBase { public IDictionary _clientProperties; public string _mechanism; public byte[] _response; public string _locale; - IDictionary ClientProperties => _clientProperties; - string Mechanism => _mechanism; - byte[] Response => _response; - string Locale => _locale; + public ConnectionStartOk() + { + } - public ConnectionStartOk() {} - public ConnectionStartOk(IDictionary @ClientProperties, string @Mechanism, byte[] @Response, string @Locale) + public ConnectionStartOk(IDictionary ClientProperties, string Mechanism, byte[] Response, string Locale) { - _clientProperties = @ClientProperties; - _mechanism = @Mechanism; - _response = @Response; - _locale = @Locale; + _clientProperties = ClientProperties; + _mechanism = Mechanism; + _response = Response; + _locale = Locale; } public override ushort ProtocolClassId => ClassConstants.Connection; @@ -62,7 +59,7 @@ public ConnectionStartOk(IDictionary @ClientProperties, string @ public override string ProtocolMethodName => "connection.start-ok"; public override bool HasContent => false; - public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + public override void ReadArgumentsFrom(ref MethodArgumentReader reader) { _clientProperties = reader.ReadTable(); _mechanism = reader.ReadShortstr(); @@ -70,7 +67,7 @@ public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader read _locale = reader.ReadShortstr(); } - public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + public override void WriteArgumentsTo(ref MethodArgumentWriter writer) { writer.WriteTable(_clientProperties); writer.WriteShortstr(_mechanism); @@ -80,22 +77,12 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 6; // bytes for length of _mechanism, length of _response, length of _locale + int bufferSize = 1 + 4 +1; // bytes for length of _mechanism, length of _response, length of _locale bufferSize += WireFormatting.GetTableByteCount(_clientProperties); // _clientProperties in bytes bufferSize += Encoding.UTF8.GetByteCount(_mechanism); // _mechanism in bytes bufferSize += _response.Length; // _response in bytes bufferSize += Encoding.UTF8.GetByteCount(_locale); // _locale in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_clientProperties).Append(','); - sb.Append(_mechanism).Append(','); - sb.Append(_response).Append(','); - sb.Append(_locale); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionTune.cs b/projects/RabbitMQ.Client/client/framing/ConnectionTune.cs index 2c70fca6fc..c13643360e 100644 --- a/projects/RabbitMQ.Client/client/framing/ConnectionTune.cs +++ b/projects/RabbitMQ.Client/client/framing/ConnectionTune.cs @@ -29,27 +29,23 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class ConnectionTune : Client.Impl.MethodBase { public ushort _channelMax; public uint _frameMax; public ushort _heartbeat; - ushort ChannelMax => _channelMax; - uint FrameMax => _frameMax; - ushort Heartbeat => _heartbeat; + public ConnectionTune() + { + } - public ConnectionTune() {} - public ConnectionTune(ushort @ChannelMax, uint @FrameMax, ushort @Heartbeat) + public ConnectionTune(ushort ChannelMax, uint FrameMax, ushort Heartbeat) { - _channelMax = @ChannelMax; - _frameMax = @FrameMax; - _heartbeat = @Heartbeat; + _channelMax = ChannelMax; + _frameMax = FrameMax; + _heartbeat = Heartbeat; } public override ushort ProtocolClassId => ClassConstants.Connection; @@ -73,17 +69,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 8; // bytes for _channelMax, _frameMax, _heartbeat - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_channelMax).Append(','); - sb.Append(_frameMax).Append(','); - sb.Append(_heartbeat); - sb.Append(')'); + return 2 + 4 + 2; // bytes for _channelMax, _frameMax, _heartbeat } } } diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionTuneOk.cs b/projects/RabbitMQ.Client/client/framing/ConnectionTuneOk.cs index 521e1fc922..c8ecff0325 100644 --- a/projects/RabbitMQ.Client/client/framing/ConnectionTuneOk.cs +++ b/projects/RabbitMQ.Client/client/framing/ConnectionTuneOk.cs @@ -29,27 +29,23 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class ConnectionTuneOk : Client.Impl.MethodBase { public ushort _channelMax; public uint _frameMax; public ushort _heartbeat; - ushort ChannelMax => _channelMax; - uint FrameMax => _frameMax; - ushort Heartbeat => _heartbeat; + public ConnectionTuneOk() + { + } - public ConnectionTuneOk() {} - public ConnectionTuneOk(ushort @ChannelMax, uint @FrameMax, ushort @Heartbeat) + public ConnectionTuneOk(ushort ChannelMax, uint FrameMax, ushort Heartbeat) { - _channelMax = @ChannelMax; - _frameMax = @FrameMax; - _heartbeat = @Heartbeat; + _channelMax = ChannelMax; + _frameMax = FrameMax; + _heartbeat = Heartbeat; } public override ushort ProtocolClassId => ClassConstants.Connection; @@ -73,17 +69,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 8; // bytes for _channelMax, _frameMax, _heartbeat - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_channelMax).Append(','); - sb.Append(_frameMax).Append(','); - sb.Append(_heartbeat); - sb.Append(')'); + return 2 + 4 + 2; // bytes for _channelMax, _frameMax, _heartbeat } } } diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionUnblocked.cs b/projects/RabbitMQ.Client/client/framing/ConnectionUnblocked.cs index a45a03fe6c..b27ec566bf 100644 --- a/projects/RabbitMQ.Client/client/framing/ConnectionUnblocked.cs +++ b/projects/RabbitMQ.Client/client/framing/ConnectionUnblocked.cs @@ -29,15 +29,10 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class ConnectionUnblocked : Client.Impl.MethodBase { - - public ConnectionUnblocked() { } @@ -57,14 +52,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 0; - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(')'); + return 0; } } } diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionUpdateSecret.cs b/projects/RabbitMQ.Client/client/framing/ConnectionUpdateSecret.cs index c954b5c2f1..0982a592ee 100644 --- a/projects/RabbitMQ.Client/client/framing/ConnectionUpdateSecret.cs +++ b/projects/RabbitMQ.Client/client/framing/ConnectionUpdateSecret.cs @@ -33,20 +33,19 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class ConnectionUpdateSecret : Client.Impl.MethodBase { public byte[] _newSecret; public string _reason; - byte[] NewSecret => _newSecret; - string Reason => _reason; + public ConnectionUpdateSecret() + { + } - public ConnectionUpdateSecret() {} - public ConnectionUpdateSecret(byte[] @NewSecret, string @Reason) + public ConnectionUpdateSecret(byte[] NewSecret, string Reason) { - _newSecret = @NewSecret; - _reason = @Reason; + _newSecret = NewSecret; + _reason = Reason; } public override ushort ProtocolClassId => ClassConstants.Connection; @@ -68,18 +67,10 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 5; // bytes for length of _newSecret, length of _reason + int bufferSize = 4 + 1; // bytes for length of _newSecret, length of _reason bufferSize += _newSecret.Length; // _newSecret in bytes bufferSize += Encoding.UTF8.GetByteCount(_reason); // _reason in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_newSecret).Append(','); - sb.Append(_reason); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/ConnectionUpdateSecretOk.cs b/projects/RabbitMQ.Client/client/framing/ConnectionUpdateSecretOk.cs index 4d4226ef0f..37648c9103 100644 --- a/projects/RabbitMQ.Client/client/framing/ConnectionUpdateSecretOk.cs +++ b/projects/RabbitMQ.Client/client/framing/ConnectionUpdateSecretOk.cs @@ -29,15 +29,10 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class ConnectionUpdateSecretOk : Client.Impl.MethodBase { - - public ConnectionUpdateSecretOk() { } @@ -57,14 +52,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 0; - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(')'); + return 0; } } } diff --git a/projects/RabbitMQ.Client/client/framing/ExchangeBind.cs b/projects/RabbitMQ.Client/client/framing/ExchangeBind.cs index f88e68c33c..6a2b0eca2e 100644 --- a/projects/RabbitMQ.Client/client/framing/ExchangeBind.cs +++ b/projects/RabbitMQ.Client/client/framing/ExchangeBind.cs @@ -35,8 +35,7 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. - internal sealed class ExchangeBind : Client.Impl.MethodBase + internal sealed class ExchangeBind : MethodBase { public ushort _reserved1; public string _destination; @@ -45,22 +44,18 @@ internal sealed class ExchangeBind : Client.Impl.MethodBase public bool _nowait; public IDictionary _arguments; - ushort Reserved1 => _reserved1; - string Destination => _destination; - string Source => _source; - string RoutingKey => _routingKey; - bool Nowait => _nowait; - IDictionary Arguments => _arguments; + public ExchangeBind() + { + } - public ExchangeBind() {} - public ExchangeBind(ushort @Reserved1, string @Destination, string @Source, string @RoutingKey, bool @Nowait, IDictionary @Arguments) + public ExchangeBind(ushort Reserved1, string Destination, string Source, string RoutingKey, bool Nowait, IDictionary Arguments) { - _reserved1 = @Reserved1; - _destination = @Destination; - _source = @Source; - _routingKey = @RoutingKey; - _nowait = @Nowait; - _arguments = @Arguments; + _reserved1 = Reserved1; + _destination = Destination; + _source = Source; + _routingKey = RoutingKey; + _nowait = Nowait; + _arguments = Arguments; } public override ushort ProtocolClassId => ClassConstants.Exchange; @@ -68,7 +63,7 @@ public ExchangeBind(ushort @Reserved1, string @Destination, string @Source, stri public override string ProtocolMethodName => "exchange.bind"; public override bool HasContent => false; - public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + public override void ReadArgumentsFrom(ref MethodArgumentReader reader) { _reserved1 = reader.ReadShort(); _destination = reader.ReadShortstr(); @@ -78,7 +73,7 @@ public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader read _arguments = reader.ReadTable(); } - public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + public override void WriteArgumentsTo(ref MethodArgumentWriter writer) { writer.WriteShort(_reserved1); writer.WriteShortstr(_destination); @@ -91,24 +86,12 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 6; // bytes for _reserved1, length of _destination, length of _source, length of _routingKey, bit fields + int bufferSize = 2 + 1 + 1 + 1 + 1; // bytes for _reserved1, length of _destination, length of _source, length of _routingKey, bit fields bufferSize += Encoding.UTF8.GetByteCount(_destination); // _destination in bytes bufferSize += Encoding.UTF8.GetByteCount(_source); // _source in bytes bufferSize += Encoding.UTF8.GetByteCount(_routingKey); // _routingKey in bytes bufferSize += WireFormatting.GetTableByteCount(_arguments); // _arguments in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_reserved1).Append(','); - sb.Append(_destination).Append(','); - sb.Append(_source).Append(','); - sb.Append(_routingKey).Append(','); - sb.Append(_nowait).Append(','); - sb.Append(_arguments); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/ExchangeBindOk.cs b/projects/RabbitMQ.Client/client/framing/ExchangeBindOk.cs index 7b76834b44..d8aafba09f 100644 --- a/projects/RabbitMQ.Client/client/framing/ExchangeBindOk.cs +++ b/projects/RabbitMQ.Client/client/framing/ExchangeBindOk.cs @@ -29,15 +29,10 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class ExchangeBindOk : Client.Impl.MethodBase { - - public ExchangeBindOk() { } @@ -57,14 +52,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 0; - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(')'); + return 0; } } } diff --git a/projects/RabbitMQ.Client/client/framing/ExchangeDeclare.cs b/projects/RabbitMQ.Client/client/framing/ExchangeDeclare.cs index 4ad8eac299..d3ecb42fd9 100644 --- a/projects/RabbitMQ.Client/client/framing/ExchangeDeclare.cs +++ b/projects/RabbitMQ.Client/client/framing/ExchangeDeclare.cs @@ -35,8 +35,7 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. - internal sealed class ExchangeDeclare : Client.Impl.MethodBase + internal sealed class ExchangeDeclare : MethodBase { public ushort _reserved1; public string _exchange; @@ -48,28 +47,21 @@ internal sealed class ExchangeDeclare : Client.Impl.MethodBase public bool _nowait; public IDictionary _arguments; - ushort Reserved1 => _reserved1; - string Exchange => _exchange; - string Type => _type; - bool Passive => _passive; - bool Durable => _durable; - bool AutoDelete => _autoDelete; - bool Internal => _internal; - bool Nowait => _nowait; - IDictionary Arguments => _arguments; + public ExchangeDeclare() + { + } - public ExchangeDeclare() {} - public ExchangeDeclare(ushort @Reserved1, string @Exchange, string @Type, bool @Passive, bool @Durable, bool @AutoDelete, bool @Internal, bool @Nowait, IDictionary @Arguments) + public ExchangeDeclare(ushort Reserved1, string Exchange, string Type, bool Passive, bool Durable, bool AutoDelete, bool Internal, bool Nowait, IDictionary Arguments) { - _reserved1 = @Reserved1; - _exchange = @Exchange; - _type = @Type; - _passive = @Passive; - _durable = @Durable; - _autoDelete = @AutoDelete; - _internal = @Internal; - _nowait = @Nowait; - _arguments = @Arguments; + _reserved1 = Reserved1; + _exchange = Exchange; + _type = Type; + _passive = Passive; + _durable = Durable; + _autoDelete = AutoDelete; + _internal = Internal; + _nowait = Nowait; + _arguments = Arguments; } public override ushort ProtocolClassId => ClassConstants.Exchange; @@ -77,7 +69,7 @@ public ExchangeDeclare(ushort @Reserved1, string @Exchange, string @Type, bool @ public override string ProtocolMethodName => "exchange.declare"; public override bool HasContent => false; - public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + public override void ReadArgumentsFrom(ref MethodArgumentReader reader) { _reserved1 = reader.ReadShort(); _exchange = reader.ReadShortstr(); @@ -90,7 +82,7 @@ public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader read _arguments = reader.ReadTable(); } - public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + public override void WriteArgumentsTo(ref MethodArgumentWriter writer) { writer.WriteShort(_reserved1); writer.WriteShortstr(_exchange); @@ -106,26 +98,11 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 5; // bytes for _reserved1, length of _exchange, length of _type, bit fields + int bufferSize = 2 + 1 + 1 + 1; // bytes for _reserved1, length of _exchange, length of _type, bit fields bufferSize += Encoding.UTF8.GetByteCount(_exchange); // _exchange in bytes bufferSize += Encoding.UTF8.GetByteCount(_type); // _type in bytes bufferSize += WireFormatting.GetTableByteCount(_arguments); // _arguments in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_reserved1).Append(','); - sb.Append(_exchange).Append(','); - sb.Append(_type).Append(','); - sb.Append(_passive).Append(','); - sb.Append(_durable).Append(','); - sb.Append(_autoDelete).Append(','); - sb.Append(_internal).Append(','); - sb.Append(_nowait).Append(','); - sb.Append(_arguments); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/ExchangeDeclareOk.cs b/projects/RabbitMQ.Client/client/framing/ExchangeDeclareOk.cs index 2754b68a55..ba18411765 100644 --- a/projects/RabbitMQ.Client/client/framing/ExchangeDeclareOk.cs +++ b/projects/RabbitMQ.Client/client/framing/ExchangeDeclareOk.cs @@ -29,15 +29,10 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class ExchangeDeclareOk : Client.Impl.MethodBase { - - public ExchangeDeclareOk() { } @@ -57,14 +52,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 0; - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(')'); + return 0; } } } diff --git a/projects/RabbitMQ.Client/client/framing/ExchangeDelete.cs b/projects/RabbitMQ.Client/client/framing/ExchangeDelete.cs index a546b1099f..78bb7aab33 100644 --- a/projects/RabbitMQ.Client/client/framing/ExchangeDelete.cs +++ b/projects/RabbitMQ.Client/client/framing/ExchangeDelete.cs @@ -33,7 +33,6 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class ExchangeDelete : Client.Impl.MethodBase { public ushort _reserved1; @@ -41,18 +40,16 @@ internal sealed class ExchangeDelete : Client.Impl.MethodBase public bool _ifUnused; public bool _nowait; - ushort Reserved1 => _reserved1; - string Exchange => _exchange; - bool IfUnused => _ifUnused; - bool Nowait => _nowait; + public ExchangeDelete() + { + } - public ExchangeDelete() {} - public ExchangeDelete(ushort @Reserved1, string @Exchange, bool @IfUnused, bool @Nowait) + public ExchangeDelete(ushort Reserved1, string Exchange, bool IfUnused, bool Nowait) { - _reserved1 = @Reserved1; - _exchange = @Exchange; - _ifUnused = @IfUnused; - _nowait = @Nowait; + _reserved1 = Reserved1; + _exchange = Exchange; + _ifUnused = IfUnused; + _nowait = Nowait; } public override ushort ProtocolClassId => ClassConstants.Exchange; @@ -79,19 +76,9 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 4; // bytes for _reserved1, length of _exchange, bit fields + int bufferSize = 2 + 1 + 1; // bytes for _reserved1, length of _exchange, bit fields bufferSize += Encoding.UTF8.GetByteCount(_exchange); // _exchange in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_reserved1).Append(','); - sb.Append(_exchange).Append(','); - sb.Append(_ifUnused).Append(','); - sb.Append(_nowait); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/ExchangeDeleteOk.cs b/projects/RabbitMQ.Client/client/framing/ExchangeDeleteOk.cs index 34ecc40af8..ba97fffd6d 100644 --- a/projects/RabbitMQ.Client/client/framing/ExchangeDeleteOk.cs +++ b/projects/RabbitMQ.Client/client/framing/ExchangeDeleteOk.cs @@ -29,15 +29,10 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class ExchangeDeleteOk : Client.Impl.MethodBase { - - public ExchangeDeleteOk() { } @@ -57,14 +52,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 0; - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(')'); + return 0; } } } diff --git a/projects/RabbitMQ.Client/client/framing/ExchangeUnbind.cs b/projects/RabbitMQ.Client/client/framing/ExchangeUnbind.cs index bea3df94bd..f167389cf0 100644 --- a/projects/RabbitMQ.Client/client/framing/ExchangeUnbind.cs +++ b/projects/RabbitMQ.Client/client/framing/ExchangeUnbind.cs @@ -35,8 +35,7 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. - internal sealed class ExchangeUnbind : Client.Impl.MethodBase + internal sealed class ExchangeUnbind : MethodBase { public ushort _reserved1; public string _destination; @@ -45,22 +44,18 @@ internal sealed class ExchangeUnbind : Client.Impl.MethodBase public bool _nowait; public IDictionary _arguments; - ushort Reserved1 => _reserved1; - string Destination => _destination; - string Source => _source; - string RoutingKey => _routingKey; - bool Nowait => _nowait; - IDictionary Arguments => _arguments; + public ExchangeUnbind() + { + } - public ExchangeUnbind() {} - public ExchangeUnbind(ushort @Reserved1, string @Destination, string @Source, string @RoutingKey, bool @Nowait, IDictionary @Arguments) + public ExchangeUnbind(ushort Reserved1, string Destination, string Source, string RoutingKey, bool Nowait, IDictionary Arguments) { - _reserved1 = @Reserved1; - _destination = @Destination; - _source = @Source; - _routingKey = @RoutingKey; - _nowait = @Nowait; - _arguments = @Arguments; + _reserved1 = Reserved1; + _destination = Destination; + _source = Source; + _routingKey = RoutingKey; + _nowait = Nowait; + _arguments = Arguments; } public override ushort ProtocolClassId => ClassConstants.Exchange; @@ -68,7 +63,7 @@ public ExchangeUnbind(ushort @Reserved1, string @Destination, string @Source, st public override string ProtocolMethodName => "exchange.unbind"; public override bool HasContent => false; - public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + public override void ReadArgumentsFrom(ref MethodArgumentReader reader) { _reserved1 = reader.ReadShort(); _destination = reader.ReadShortstr(); @@ -78,7 +73,7 @@ public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader read _arguments = reader.ReadTable(); } - public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + public override void WriteArgumentsTo(ref MethodArgumentWriter writer) { writer.WriteShort(_reserved1); writer.WriteShortstr(_destination); @@ -91,24 +86,12 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 6; // bytes for _reserved1, length of _destination, length of _source, length of _routingKey, bit fields + int bufferSize = 2 + 1 + 1 + 1 + 1; // bytes for _reserved1, length of _destination, length of _source, length of _routingKey, bit fields bufferSize += Encoding.UTF8.GetByteCount(_destination); // _destination in bytes bufferSize += Encoding.UTF8.GetByteCount(_source); // _source in bytes bufferSize += Encoding.UTF8.GetByteCount(_routingKey); // _routingKey in bytes bufferSize += WireFormatting.GetTableByteCount(_arguments); // _arguments in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_reserved1).Append(','); - sb.Append(_destination).Append(','); - sb.Append(_source).Append(','); - sb.Append(_routingKey).Append(','); - sb.Append(_nowait).Append(','); - sb.Append(_arguments); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/ExchangeUnbindOk.cs b/projects/RabbitMQ.Client/client/framing/ExchangeUnbindOk.cs index 8e71c8b7d2..5536d93aa5 100644 --- a/projects/RabbitMQ.Client/client/framing/ExchangeUnbindOk.cs +++ b/projects/RabbitMQ.Client/client/framing/ExchangeUnbindOk.cs @@ -29,15 +29,10 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class ExchangeUnbindOk : Client.Impl.MethodBase { - - public ExchangeUnbindOk() { } @@ -57,14 +52,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 0; - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(')'); + return 0; } } } diff --git a/projects/RabbitMQ.Client/client/framing/Model.cs b/projects/RabbitMQ.Client/client/framing/Model.cs index 0aa4d05f7f..c50e14e45c 100644 --- a/projects/RabbitMQ.Client/client/framing/Model.cs +++ b/projects/RabbitMQ.Client/client/framing/Model.cs @@ -36,444 +36,337 @@ namespace RabbitMQ.Client.Framing.Impl { - internal class Model: Client.Impl.ModelBase + internal class Model: ModelBase { - public Model(Client.Impl.ISession session): base(session) {} - public Model(Client.Impl.ISession session, ConsumerWorkService workService): base(session, workService) {} - public override void ConnectionTuneOk (ushort @channelMax, uint @frameMax, ushort @heartbeat) + public Model(ISession session) + : base(session) { - ConnectionTuneOk __req = new ConnectionTuneOk() - { - _channelMax = @channelMax, - _frameMax = @frameMax, - _heartbeat = @heartbeat, - }; - ModelSend(__req,null,null); } - public override void _Private_BasicCancel (string @consumerTag, bool @nowait) + + public Model(ISession session, ConsumerWorkService workService) + : base(session, workService) { - BasicCancel __req = new BasicCancel() - { - _consumerTag = @consumerTag, - _nowait = @nowait, - }; - ModelSend(__req,null,null); } - public override void _Private_BasicConsume (string @queue, string @consumerTag, bool @noLocal, bool @autoAck, bool @exclusive, bool @nowait, IDictionary @arguments) + + public override void ConnectionTuneOk(ushort channelMax, uint frameMax, ushort heartbeat) { - BasicConsume __req = new BasicConsume() - { - _queue = @queue, - _consumerTag = @consumerTag, - _noLocal = @noLocal, - _noAck = @autoAck, - _exclusive = @exclusive, - _nowait = @nowait, - _arguments = @arguments, - }; - ModelSend(__req,null,null); - } - public override void _Private_BasicGet (string @queue, bool @autoAck) - { - BasicGet __req = new BasicGet() - { - _queue = @queue, - _noAck = @autoAck, - }; - ModelSend(__req,null,null); + ModelSend(new ConnectionTuneOk(channelMax, frameMax, heartbeat)); } - public override void _Private_BasicPublish (string @exchange, string @routingKey, bool @mandatory, RabbitMQ.Client.IBasicProperties @basicProperties, ReadOnlyMemory @body) + + public override void _Private_BasicCancel(string consumerTag, bool nowait) { - BasicPublish __req = new BasicPublish() - { - _exchange = @exchange, - _routingKey = @routingKey, - _mandatory = @mandatory, - }; - ModelSend(__req, (BasicProperties) basicProperties,body); + ModelSend(new BasicCancel(consumerTag, nowait)); } - public override void _Private_BasicRecover (bool @requeue) + + public override void _Private_BasicConsume(string queue, string consumerTag, bool noLocal, bool autoAck, bool exclusive, bool nowait, IDictionary arguments) { - BasicRecover __req = new BasicRecover() - { - _requeue = @requeue, - }; - ModelSend(__req,null,null); + ModelSend(new BasicConsume(default, queue, consumerTag, noLocal, autoAck, exclusive, nowait, arguments)); + } + + public override void _Private_BasicGet(string queue, bool autoAck) + { + ModelSend(new BasicGet(default, queue, autoAck)); } - public override void _Private_ChannelClose (ushort @replyCode, string @replyText, ushort @classId, ushort @methodId) + + public override void _Private_BasicPublish(string exchange, string routingKey, bool mandatory, IBasicProperties basicProperties, ReadOnlyMemory body) { - ChannelClose __req = new ChannelClose() - { - _replyCode = @replyCode, - _replyText = @replyText, - _classId = @classId, - _methodId = @methodId, - }; - ModelSend(__req,null,null); + ModelSend(new BasicPublish(default, exchange, routingKey, mandatory, default), (BasicProperties) basicProperties, body); } - public override void _Private_ChannelCloseOk () + + public override void _Private_BasicRecover(bool requeue) { - ChannelCloseOk __req = new ChannelCloseOk(); - ModelSend(__req,null,null); + ModelSend(new BasicRecover(requeue)); } - public override void _Private_ChannelFlowOk (bool @active) + + public override void _Private_ChannelClose(ushort replyCode, string replyText, ushort classId, ushort methodId) { - ChannelFlowOk __req = new ChannelFlowOk() - { - _active = @active, - }; - ModelSend(__req,null,null); + ModelSend(new ChannelClose(replyCode, replyText, classId, methodId)); } - public override void _Private_ChannelOpen (string @outOfBand) + + public override void _Private_ChannelCloseOk() { - ChannelOpen __req = new ChannelOpen() - { - _reserved1 = @outOfBand, - }; - Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); + ModelSend(new ChannelCloseOk()); + } + + public override void _Private_ChannelFlowOk(bool active) + { + ModelSend(new ChannelFlowOk(active)); + } + + public override void _Private_ChannelOpen(string outOfBand) + { + MethodBase __repBase = ModelRpc(new ChannelOpen(outOfBand)); if (!(__repBase is ChannelOpenOk)) { throw new UnexpectedMethodException(__repBase); } } - public override void _Private_ConfirmSelect (bool @nowait) + + public override void _Private_ConfirmSelect(bool nowait) { - ConfirmSelect __req = new ConfirmSelect() + var method = new ConfirmSelect(nowait); + if (nowait) { - _nowait = @nowait, - }; - if (nowait) { - ModelSend(__req,null,null); - return; + ModelSend(method); } - Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); - if (!(__repBase is ConfirmSelectOk)) + else { - throw new UnexpectedMethodException(__repBase); + MethodBase __repBase = ModelRpc(method); + if (!(__repBase is ConfirmSelectOk)) + { + throw new UnexpectedMethodException(__repBase); + } } } - public override void _Private_ConnectionClose (ushort @replyCode, string @replyText, ushort @classId, ushort @methodId) + + public override void _Private_ConnectionClose(ushort replyCode, string replyText, ushort classId, ushort methodId) { - ConnectionClose __req = new ConnectionClose() - { - _replyCode = @replyCode, - _replyText = @replyText, - _classId = @classId, - _methodId = @methodId, - }; - Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); + MethodBase __repBase = ModelRpc(new ConnectionClose(replyCode, replyText, classId, methodId)); if (!(__repBase is ConnectionCloseOk)) { throw new UnexpectedMethodException(__repBase); } } - public override void _Private_ConnectionCloseOk () + + public override void _Private_ConnectionCloseOk() { - ConnectionCloseOk __req = new ConnectionCloseOk(); - ModelSend(__req,null,null); + ModelSend(new ConnectionCloseOk()); } - public override void _Private_ConnectionOpen (string @virtualHost, string @capabilities, bool @insist) + + public override void _Private_ConnectionOpen(string virtualHost, string capabilities, bool insist) { - ConnectionOpen __req = new ConnectionOpen() - { - _virtualHost = @virtualHost, - _reserved1 = @capabilities, - _reserved2 = @insist, - }; - ModelSend(__req,null,null); + ModelSend(new ConnectionOpen(virtualHost, capabilities, insist)); } - public override void _Private_ConnectionSecureOk (byte[] @response) + + public override void _Private_ConnectionSecureOk(byte[] response) { - ConnectionSecureOk __req = new ConnectionSecureOk() - { - _response = @response, - }; - ModelSend(__req,null,null); + ModelSend(new ConnectionSecureOk(response)); } - public override void _Private_ConnectionStartOk (IDictionary @clientProperties, string @mechanism, byte[] @response, string @locale) + + public override void _Private_ConnectionStartOk(IDictionary clientProperties, string mechanism, byte[] response, string locale) { - ConnectionStartOk __req = new ConnectionStartOk() - { - _clientProperties = @clientProperties, - _mechanism = @mechanism, - _response = @response, - _locale = @locale, - }; - ModelSend(__req,null,null); + ModelSend(new ConnectionStartOk(clientProperties, mechanism, response, locale)); } - public override void _Private_UpdateSecret (byte[] @newSecret, string @reason) + + public override void _Private_UpdateSecret(byte[] newSecret, string reason) { - ConnectionUpdateSecret __req = new ConnectionUpdateSecret() - { - _newSecret = @newSecret, - _reason = @reason, - }; - Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); + MethodBase __repBase = ModelRpc(new ConnectionUpdateSecret(newSecret, reason)); if (!(__repBase is ConnectionUpdateSecretOk)) { throw new UnexpectedMethodException(__repBase); } } - public override void _Private_ExchangeBind (string @destination, string @source, string @routingKey, bool @nowait, IDictionary @arguments) + + public override void _Private_ExchangeBind(string destination, string source, string routingKey, bool nowait, IDictionary arguments) { - ExchangeBind __req = new ExchangeBind() + ExchangeBind method = new ExchangeBind(default, destination, source, routingKey, nowait, arguments); + if (nowait) { - _destination = @destination, - _source = @source, - _routingKey = @routingKey, - _nowait = @nowait, - _arguments = @arguments, - }; - if (nowait) { - ModelSend(__req,null,null); - return; + ModelSend(method); } - Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); - if (!(__repBase is ExchangeBindOk)) + else { - throw new UnexpectedMethodException(__repBase); + MethodBase __repBase = ModelRpc(method); + if (!(__repBase is ExchangeBindOk)) + { + throw new UnexpectedMethodException(__repBase); + } } } - public override void _Private_ExchangeDeclare (string @exchange, string @type, bool @passive, bool @durable, bool @autoDelete, bool @internal, bool @nowait, IDictionary @arguments) + + public override void _Private_ExchangeDeclare(string exchange, string type, bool passive, bool durable, bool autoDelete, bool @internal, bool nowait, IDictionary arguments) { - ExchangeDeclare __req = new ExchangeDeclare() + ExchangeDeclare method = new ExchangeDeclare(default, exchange, type, passive, durable, autoDelete, @internal, nowait, arguments); + if (nowait) { - _exchange = @exchange, - _type = @type, - _passive = @passive, - _durable = @durable, - _autoDelete = @autoDelete, - _internal = @internal, - _nowait = @nowait, - _arguments = @arguments, - }; - if (nowait) { - ModelSend(__req,null,null); - return; + ModelSend(method); } - Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); - if (!(__repBase is ExchangeDeclareOk)) + else { - throw new UnexpectedMethodException(__repBase); + MethodBase __repBase = ModelRpc(method); + if (!(__repBase is ExchangeDeclareOk)) + { + throw new UnexpectedMethodException(__repBase); + } } } - public override void _Private_ExchangeDelete (string @exchange, bool @ifUnused, bool @nowait) + + public override void _Private_ExchangeDelete(string exchange, bool ifUnused, bool nowait) { - ExchangeDelete __req = new ExchangeDelete() + ExchangeDelete method = new ExchangeDelete(default, exchange, ifUnused, nowait); + if (nowait) { - _exchange = @exchange, - _ifUnused = @ifUnused, - _nowait = @nowait, - }; - if (nowait) { - ModelSend(__req,null,null); - return; + ModelSend(method); } - Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); - if (!(__repBase is ExchangeDeleteOk)) + else { - throw new UnexpectedMethodException(__repBase); + MethodBase __repBase = ModelRpc(method); + if (!(__repBase is ExchangeDeleteOk)) + { + throw new UnexpectedMethodException(__repBase); + } } } - public override void _Private_ExchangeUnbind (string @destination, string @source, string @routingKey, bool @nowait, IDictionary @arguments) + + public override void _Private_ExchangeUnbind(string destination, string source, string routingKey, bool nowait, IDictionary arguments) { - ExchangeUnbind __req = new ExchangeUnbind() + ExchangeUnbind method = new ExchangeUnbind(default, destination, source, routingKey, nowait, arguments); + if (nowait) { - _destination = @destination, - _source = @source, - _routingKey = @routingKey, - _nowait = @nowait, - _arguments = @arguments, - }; - if (nowait) { - ModelSend(__req,null,null); - return; + ModelSend(method); } - Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); - if (!(__repBase is ExchangeUnbindOk)) + else { - throw new UnexpectedMethodException(__repBase); + MethodBase __repBase = ModelRpc(method); + if (!(__repBase is ExchangeUnbindOk)) + { + throw new UnexpectedMethodException(__repBase); + } } } - public override void _Private_QueueBind (string @queue, string @exchange, string @routingKey, bool @nowait, IDictionary @arguments) + + public override void _Private_QueueBind(string queue, string exchange, string routingKey, bool nowait, IDictionary arguments) { - QueueBind __req = new QueueBind() + QueueBind method = new QueueBind(default, queue, exchange, routingKey, nowait, arguments); + if (nowait) { - _queue = @queue, - _exchange = @exchange, - _routingKey = @routingKey, - _nowait = @nowait, - _arguments = @arguments, - }; - if (nowait) { - ModelSend(__req,null,null); - return; + ModelSend(method); } - Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); - if (!(__repBase is QueueBindOk)) + else { - throw new UnexpectedMethodException(__repBase); + MethodBase __repBase = ModelRpc(method); + if (!(__repBase is QueueBindOk)) + { + throw new UnexpectedMethodException(__repBase); + } } } - public override void _Private_QueueDeclare (string @queue, bool @passive, bool @durable, bool @exclusive, bool @autoDelete, bool @nowait, IDictionary @arguments) + + public override void _Private_QueueDeclare(string queue, bool passive, bool durable, bool exclusive, bool autoDelete, bool nowait, IDictionary arguments) { - QueueDeclare __req = new QueueDeclare() + QueueDeclare method = new QueueDeclare(default, queue, passive, durable, exclusive, autoDelete, nowait, arguments); + if (nowait) { - _queue = @queue, - _passive = @passive, - _durable = @durable, - _exclusive = @exclusive, - _autoDelete = @autoDelete, - _nowait = @nowait, - _arguments = @arguments, - }; - if (nowait) { - ModelSend(__req,null,null); - return; + ModelSend(method); + } + else + { + ModelSend(method); } - ModelSend(__req,null,null); } - public override uint _Private_QueueDelete (string @queue, bool @ifUnused, bool @ifEmpty, bool @nowait) + + public override uint _Private_QueueDelete(string queue, bool ifUnused, bool ifEmpty, bool nowait) { - QueueDelete __req = new QueueDelete() + QueueDelete method = new QueueDelete(default, queue, ifUnused, ifEmpty, nowait); + if (nowait) { - _queue = @queue, - _ifUnused = @ifUnused, - _ifEmpty = @ifEmpty, - _nowait = @nowait, - }; - if (nowait) { - ModelSend(__req,null,null); + ModelSend(method); return 0xFFFFFFFF; } - Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); + + MethodBase __repBase = ModelRpc(method); if (!(__repBase is QueueDeleteOk __rep)) { throw new UnexpectedMethodException(__repBase); } return __rep._messageCount; } - public override uint _Private_QueuePurge (string @queue, bool @nowait) + + public override uint _Private_QueuePurge(string queue, bool nowait) { - QueuePurge __req = new QueuePurge() + QueuePurge method = new QueuePurge(default, queue, nowait); + if (nowait) { - _queue = @queue, - _nowait = @nowait, - }; - if (nowait) { - ModelSend(__req,null,null); + ModelSend(method); return 0xFFFFFFFF; } - Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); + + MethodBase __repBase = ModelRpc(method); if (!(__repBase is QueuePurgeOk __rep)) { throw new UnexpectedMethodException(__repBase); } return __rep._messageCount; } - public override void BasicAck (ulong @deliveryTag, bool @multiple) + + public override void BasicAck(ulong deliveryTag, bool multiple) { - BasicAck __req = new BasicAck() - { - _deliveryTag = @deliveryTag, - _multiple = @multiple, - }; - ModelSend(__req,null,null); + ModelSend(new BasicAck(deliveryTag, multiple)); } - public override void BasicNack (ulong @deliveryTag, bool @multiple, bool @requeue) + + public override void BasicNack(ulong deliveryTag, bool multiple, bool requeue) { - BasicNack __req = new BasicNack() - { - _deliveryTag = @deliveryTag, - _multiple = @multiple, - _requeue = @requeue, - }; - ModelSend(__req,null,null); + ModelSend(new BasicNack(deliveryTag, multiple, requeue)); } - public override void BasicQos (uint @prefetchSize, ushort @prefetchCount, bool @global) + + public override void BasicQos(uint prefetchSize, ushort prefetchCount, bool global) { - BasicQos __req = new BasicQos() - { - _prefetchSize = @prefetchSize, - _prefetchCount = @prefetchCount, - _global = @global, - }; - Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); + MethodBase __repBase = ModelRpc(new BasicQos(prefetchSize, prefetchCount, global)); if (!(__repBase is BasicQosOk)) { throw new UnexpectedMethodException(__repBase); } } - public override void BasicRecoverAsync (bool @requeue) + + public override void BasicRecoverAsync(bool requeue) { - BasicRecoverAsync __req = new BasicRecoverAsync() - { - _requeue = @requeue, - }; - ModelSend(__req,null,null); + ModelSend(new BasicRecoverAsync(requeue)); } - public override void BasicReject (ulong @deliveryTag, bool @requeue) + + public override void BasicReject(ulong deliveryTag, bool requeue) { - BasicReject __req = new BasicReject() - { - _deliveryTag = @deliveryTag, - _requeue = @requeue, - }; - ModelSend(__req,null,null); + ModelSend(new BasicReject(deliveryTag, requeue)); } - public override RabbitMQ.Client.IBasicProperties CreateBasicProperties () + + public override IBasicProperties CreateBasicProperties() { return new BasicProperties(); } - public override void QueueUnbind (string @queue, string @exchange, string @routingKey, IDictionary @arguments) + + public override void QueueUnbind(string queue, string exchange, string routingKey, IDictionary arguments) { - QueueUnbind __req = new QueueUnbind() - { - _queue = @queue, - _exchange = @exchange, - _routingKey = @routingKey, - _arguments = @arguments, - }; - Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); + MethodBase __repBase = ModelRpc(new QueueUnbind(default, queue, exchange, routingKey, arguments)); if (!(__repBase is QueueUnbindOk)) { throw new UnexpectedMethodException(__repBase); } } - public override void TxCommit () + + public override void TxCommit() { - TxCommit __req = new TxCommit(); - Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); + MethodBase __repBase = ModelRpc(new TxCommit()); if (!(__repBase is TxCommitOk)) { throw new UnexpectedMethodException(__repBase); } } - public override void TxRollback () + + public override void TxRollback() { - TxRollback __req = new TxRollback(); - Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); + MethodBase __repBase = ModelRpc(new TxRollback()); if (!(__repBase is TxRollbackOk)) { throw new UnexpectedMethodException(__repBase); } } - public override void TxSelect () + + public override void TxSelect() { - TxSelect __req = new TxSelect(); - Client.Impl.MethodBase __repBase = ModelRpc(__req, null, null); + MethodBase __repBase = ModelRpc(new TxSelect()); if (!(__repBase is TxSelectOk)) { throw new UnexpectedMethodException(__repBase); } } - public override bool DispatchAsynchronous(in IncomingCommand cmd) { + + public override bool DispatchAsynchronous(in IncomingCommand cmd) + { switch ((cmd.Method.ProtocolClassId << 16) | cmd.Method.ProtocolMethodId) { case (ClassConstants.Basic << 16) | BasicMethodConstants.Deliver: { var __impl = (BasicDeliver)cmd.Method; - HandleBasicDeliver(__impl._consumerTag, __impl._deliveryTag, __impl._redelivered, __impl._exchange, __impl._routingKey, (RabbitMQ.Client.IBasicProperties) cmd.Header, cmd.Body, cmd.TakeoverPayload()); + HandleBasicDeliver(__impl._consumerTag, __impl._deliveryTag, __impl._redelivered, __impl._exchange, __impl._routingKey, (IBasicProperties) cmd.Header, cmd.Body, cmd.TakeoverPayload()); return true; } case (ClassConstants.Basic << 16) | BasicMethodConstants.Ack: @@ -508,7 +401,7 @@ public override bool DispatchAsynchronous(in IncomingCommand cmd) { case (ClassConstants.Basic << 16) | BasicMethodConstants.GetOk: { var __impl = (BasicGetOk)cmd.Method; - HandleBasicGetOk(__impl._deliveryTag, __impl._redelivered, __impl._exchange, __impl._routingKey, __impl._messageCount, (RabbitMQ.Client.IBasicProperties) cmd.Header, cmd.Body, cmd.TakeoverPayload()); + HandleBasicGetOk(__impl._deliveryTag, __impl._redelivered, __impl._exchange, __impl._routingKey, __impl._messageCount, (IBasicProperties) cmd.Header, cmd.Body, cmd.TakeoverPayload()); return true; } case (ClassConstants.Basic << 16) | BasicMethodConstants.Nack: @@ -525,7 +418,7 @@ public override bool DispatchAsynchronous(in IncomingCommand cmd) { case (ClassConstants.Basic << 16) | BasicMethodConstants.Return: { var __impl = (BasicReturn)cmd.Method; - HandleBasicReturn(__impl._replyCode, __impl._replyText, __impl._exchange, __impl._routingKey, (RabbitMQ.Client.IBasicProperties) cmd.Header, cmd.Body, cmd.TakeoverPayload()); + HandleBasicReturn(__impl._replyCode, __impl._replyText, __impl._exchange, __impl._routingKey, (IBasicProperties) cmd.Header, cmd.Body, cmd.TakeoverPayload()); return true; } case (ClassConstants.Channel << 16) | ChannelMethodConstants.Close: diff --git a/projects/RabbitMQ.Client/client/framing/Protocol.cs b/projects/RabbitMQ.Client/client/framing/Protocol.cs index 19573e5534..bc500a41ce 100644 --- a/projects/RabbitMQ.Client/client/framing/Protocol.cs +++ b/projects/RabbitMQ.Client/client/framing/Protocol.cs @@ -34,7 +34,7 @@ namespace RabbitMQ.Client.Framing { - internal sealed class Protocol : RabbitMQ.Client.Framing.Impl.ProtocolBase + internal sealed class Protocol : ProtocolBase { ///Protocol major version (= 0) public override int MajorVersion => 0; @@ -63,77 +63,77 @@ internal override Client.Impl.MethodBase DecodeMethodFrom(ReadOnlySpan spa return result; } - throw new Client.Exceptions.UnknownClassOrMethodException(classId, methodId); + throw new Exceptions.UnknownClassOrMethodException(classId, methodId); } internal Client.Impl.MethodBase DecodeMethodFrom(ushort classId, ushort methodId) { switch ((classId << 16) | methodId) { - case (ClassConstants.Connection << 16) | ConnectionMethodConstants.Start: return new Impl.ConnectionStart(); - case (ClassConstants.Connection << 16) | ConnectionMethodConstants.StartOk: return new Impl.ConnectionStartOk(); - case (ClassConstants.Connection << 16) | ConnectionMethodConstants.Secure: return new Impl.ConnectionSecure(); - case (ClassConstants.Connection << 16) | ConnectionMethodConstants.SecureOk: return new Impl.ConnectionSecureOk(); - case (ClassConstants.Connection << 16) | ConnectionMethodConstants.Tune: return new Impl.ConnectionTune(); - case (ClassConstants.Connection << 16) | ConnectionMethodConstants.TuneOk: return new Impl.ConnectionTuneOk(); - case (ClassConstants.Connection << 16) | ConnectionMethodConstants.Open: return new Impl.ConnectionOpen(); - case (ClassConstants.Connection << 16) | ConnectionMethodConstants.OpenOk: return new Impl.ConnectionOpenOk(); - case (ClassConstants.Connection << 16) | ConnectionMethodConstants.Close: return new Impl.ConnectionClose(); - case (ClassConstants.Connection << 16) | ConnectionMethodConstants.CloseOk: return new Impl.ConnectionCloseOk(); - case (ClassConstants.Connection << 16) | ConnectionMethodConstants.Blocked: return new Impl.ConnectionBlocked(); - case (ClassConstants.Connection << 16) | ConnectionMethodConstants.Unblocked: return new Impl.ConnectionUnblocked(); - case (ClassConstants.Connection << 16) | ConnectionMethodConstants.UpdateSecret: return new Impl.ConnectionUpdateSecret(); - case (ClassConstants.Connection << 16) | ConnectionMethodConstants.UpdateSecretOk: return new Impl.ConnectionUpdateSecretOk(); - case (ClassConstants.Channel << 16) | ChannelMethodConstants.Open: return new Impl.ChannelOpen(); - case (ClassConstants.Channel << 16) | ChannelMethodConstants.OpenOk: return new Impl.ChannelOpenOk(); - case (ClassConstants.Channel << 16) | ChannelMethodConstants.Flow: return new Impl.ChannelFlow(); - case (ClassConstants.Channel << 16) | ChannelMethodConstants.FlowOk: return new Impl.ChannelFlowOk(); - case (ClassConstants.Channel << 16) | ChannelMethodConstants.Close: return new Impl.ChannelClose(); - case (ClassConstants.Channel << 16) | ChannelMethodConstants.CloseOk: return new Impl.ChannelCloseOk(); - case (ClassConstants.Exchange << 16) | ExchangeMethodConstants.Declare: return new Impl.ExchangeDeclare(); - case (ClassConstants.Exchange << 16) | ExchangeMethodConstants.DeclareOk: return new Impl.ExchangeDeclareOk(); - case (ClassConstants.Exchange << 16) | ExchangeMethodConstants.Delete: return new Impl.ExchangeDelete(); - case (ClassConstants.Exchange << 16) | ExchangeMethodConstants.DeleteOk: return new Impl.ExchangeDeleteOk(); - case (ClassConstants.Exchange << 16) | ExchangeMethodConstants.Bind: return new Impl.ExchangeBind(); - case (ClassConstants.Exchange << 16) | ExchangeMethodConstants.BindOk: return new Impl.ExchangeBindOk(); - case (ClassConstants.Exchange << 16) | ExchangeMethodConstants.Unbind: return new Impl.ExchangeUnbind(); - case (ClassConstants.Exchange << 16) | ExchangeMethodConstants.UnbindOk: return new Impl.ExchangeUnbindOk(); - case (ClassConstants.Queue << 16) | QueueMethodConstants.Declare: return new Impl.QueueDeclare(); + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.Start: return new ConnectionStart(); + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.StartOk: return new ConnectionStartOk(); + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.Secure: return new ConnectionSecure(); + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.SecureOk: return new ConnectionSecureOk(); + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.Tune: return new ConnectionTune(); + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.TuneOk: return new ConnectionTuneOk(); + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.Open: return new ConnectionOpen(); + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.OpenOk: return new ConnectionOpenOk(); + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.Close: return new ConnectionClose(); + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.CloseOk: return new ConnectionCloseOk(); + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.Blocked: return new ConnectionBlocked(); + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.Unblocked: return new ConnectionUnblocked(); + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.UpdateSecret: return new ConnectionUpdateSecret(); + case (ClassConstants.Connection << 16) | ConnectionMethodConstants.UpdateSecretOk: return new ConnectionUpdateSecretOk(); + case (ClassConstants.Channel << 16) | ChannelMethodConstants.Open: return new ChannelOpen(); + case (ClassConstants.Channel << 16) | ChannelMethodConstants.OpenOk: return new ChannelOpenOk(); + case (ClassConstants.Channel << 16) | ChannelMethodConstants.Flow: return new ChannelFlow(); + case (ClassConstants.Channel << 16) | ChannelMethodConstants.FlowOk: return new ChannelFlowOk(); + case (ClassConstants.Channel << 16) | ChannelMethodConstants.Close: return new ChannelClose(); + case (ClassConstants.Channel << 16) | ChannelMethodConstants.CloseOk: return new ChannelCloseOk(); + case (ClassConstants.Exchange << 16) | ExchangeMethodConstants.Declare: return new ExchangeDeclare(); + case (ClassConstants.Exchange << 16) | ExchangeMethodConstants.DeclareOk: return new ExchangeDeclareOk(); + case (ClassConstants.Exchange << 16) | ExchangeMethodConstants.Delete: return new ExchangeDelete(); + case (ClassConstants.Exchange << 16) | ExchangeMethodConstants.DeleteOk: return new ExchangeDeleteOk(); + case (ClassConstants.Exchange << 16) | ExchangeMethodConstants.Bind: return new ExchangeBind(); + case (ClassConstants.Exchange << 16) | ExchangeMethodConstants.BindOk: return new ExchangeBindOk(); + case (ClassConstants.Exchange << 16) | ExchangeMethodConstants.Unbind: return new ExchangeUnbind(); + case (ClassConstants.Exchange << 16) | ExchangeMethodConstants.UnbindOk: return new ExchangeUnbindOk(); + case (ClassConstants.Queue << 16) | QueueMethodConstants.Declare: return new QueueDeclare(); case (ClassConstants.Queue << 16) | QueueMethodConstants.DeclareOk: return new Impl.QueueDeclareOk(); - case (ClassConstants.Queue << 16) | QueueMethodConstants.Bind: return new Impl.QueueBind(); - case (ClassConstants.Queue << 16) | QueueMethodConstants.BindOk: return new Impl.QueueBindOk(); - case (ClassConstants.Queue << 16) | QueueMethodConstants.Unbind: return new Impl.QueueUnbind(); - case (ClassConstants.Queue << 16) | QueueMethodConstants.UnbindOk: return new Impl.QueueUnbindOk(); - case (ClassConstants.Queue << 16) | QueueMethodConstants.Purge: return new Impl.QueuePurge(); - case (ClassConstants.Queue << 16) | QueueMethodConstants.PurgeOk: return new Impl.QueuePurgeOk(); - case (ClassConstants.Queue << 16) | QueueMethodConstants.Delete: return new Impl.QueueDelete(); - case (ClassConstants.Queue << 16) | QueueMethodConstants.DeleteOk: return new Impl.QueueDeleteOk(); - case (ClassConstants.Basic << 16) | BasicMethodConstants.Qos: return new Impl.BasicQos(); - case (ClassConstants.Basic << 16) | BasicMethodConstants.QosOk: return new Impl.BasicQosOk(); - case (ClassConstants.Basic << 16) | BasicMethodConstants.Consume: return new Impl.BasicConsume(); - case (ClassConstants.Basic << 16) | BasicMethodConstants.ConsumeOk: return new Impl.BasicConsumeOk(); - case (ClassConstants.Basic << 16) | BasicMethodConstants.Cancel: return new Impl.BasicCancel(); - case (ClassConstants.Basic << 16) | BasicMethodConstants.CancelOk: return new Impl.BasicCancelOk(); - case (ClassConstants.Basic << 16) | BasicMethodConstants.Publish: return new Impl.BasicPublish(); - case (ClassConstants.Basic << 16) | BasicMethodConstants.Return: return new Impl.BasicReturn(); - case (ClassConstants.Basic << 16) | BasicMethodConstants.Deliver: return new Impl.BasicDeliver(); - case (ClassConstants.Basic << 16) | BasicMethodConstants.Get: return new Impl.BasicGet(); - case (ClassConstants.Basic << 16) | BasicMethodConstants.GetOk: return new Impl.BasicGetOk(); - case (ClassConstants.Basic << 16) | BasicMethodConstants.GetEmpty: return new Impl.BasicGetEmpty(); - case (ClassConstants.Basic << 16) | BasicMethodConstants.Ack: return new Impl.BasicAck(); - case (ClassConstants.Basic << 16) | BasicMethodConstants.Reject: return new Impl.BasicReject(); - case (ClassConstants.Basic << 16) | BasicMethodConstants.RecoverAsync: return new Impl.BasicRecoverAsync(); - case (ClassConstants.Basic << 16) | BasicMethodConstants.Recover: return new Impl.BasicRecover(); - case (ClassConstants.Basic << 16) | BasicMethodConstants.RecoverOk: return new Impl.BasicRecoverOk(); - case (ClassConstants.Basic << 16) | BasicMethodConstants.Nack: return new Impl.BasicNack(); - case (ClassConstants.Tx << 16) | TxMethodConstants.Select: return new Impl.TxSelect(); - case (ClassConstants.Tx << 16) | TxMethodConstants.SelectOk: return new Impl.TxSelectOk(); - case (ClassConstants.Tx << 16) | TxMethodConstants.Commit: return new Impl.TxCommit(); - case (ClassConstants.Tx << 16) | TxMethodConstants.CommitOk: return new Impl.TxCommitOk(); - case (ClassConstants.Tx << 16) | TxMethodConstants.Rollback: return new Impl.TxRollback(); - case (ClassConstants.Tx << 16) | TxMethodConstants.RollbackOk: return new Impl.TxRollbackOk(); - case (ClassConstants.Confirm << 16) | ConfirmMethodConstants.Select: return new Impl.ConfirmSelect(); - case (ClassConstants.Confirm << 16) | ConfirmMethodConstants.SelectOk: return new Impl.ConfirmSelectOk(); + case (ClassConstants.Queue << 16) | QueueMethodConstants.Bind: return new QueueBind(); + case (ClassConstants.Queue << 16) | QueueMethodConstants.BindOk: return new QueueBindOk(); + case (ClassConstants.Queue << 16) | QueueMethodConstants.Unbind: return new QueueUnbind(); + case (ClassConstants.Queue << 16) | QueueMethodConstants.UnbindOk: return new QueueUnbindOk(); + case (ClassConstants.Queue << 16) | QueueMethodConstants.Purge: return new QueuePurge(); + case (ClassConstants.Queue << 16) | QueueMethodConstants.PurgeOk: return new QueuePurgeOk(); + case (ClassConstants.Queue << 16) | QueueMethodConstants.Delete: return new QueueDelete(); + case (ClassConstants.Queue << 16) | QueueMethodConstants.DeleteOk: return new QueueDeleteOk(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.Qos: return new BasicQos(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.QosOk: return new BasicQosOk(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.Consume: return new BasicConsume(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.ConsumeOk: return new BasicConsumeOk(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.Cancel: return new BasicCancel(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.CancelOk: return new BasicCancelOk(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.Publish: return new BasicPublish(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.Return: return new BasicReturn(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.Deliver: return new BasicDeliver(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.Get: return new BasicGet(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.GetOk: return new BasicGetOk(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.GetEmpty: return new BasicGetEmpty(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.Ack: return new BasicAck(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.Reject: return new BasicReject(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.RecoverAsync: return new BasicRecoverAsync(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.Recover: return new BasicRecover(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.RecoverOk: return new BasicRecoverOk(); + case (ClassConstants.Basic << 16) | BasicMethodConstants.Nack: return new BasicNack(); + case (ClassConstants.Tx << 16) | TxMethodConstants.Select: return new TxSelect(); + case (ClassConstants.Tx << 16) | TxMethodConstants.SelectOk: return new TxSelectOk(); + case (ClassConstants.Tx << 16) | TxMethodConstants.Commit: return new TxCommit(); + case (ClassConstants.Tx << 16) | TxMethodConstants.CommitOk: return new TxCommitOk(); + case (ClassConstants.Tx << 16) | TxMethodConstants.Rollback: return new TxRollback(); + case (ClassConstants.Tx << 16) | TxMethodConstants.RollbackOk: return new TxRollbackOk(); + case (ClassConstants.Confirm << 16) | ConfirmMethodConstants.Select: return new ConfirmSelect(); + case (ClassConstants.Confirm << 16) | ConfirmMethodConstants.SelectOk: return new ConfirmSelectOk(); default: return null; } } @@ -144,7 +144,7 @@ internal override Client.Impl.ContentHeaderBase DecodeContentHeaderFrom(ushort c switch (classId) { case 60: return new BasicProperties(); - default: throw new Client.Exceptions.UnknownClassOrMethodException(classId, 0); + default: throw new Exceptions.UnknownClassOrMethodException(classId, 0); } } } diff --git a/projects/RabbitMQ.Client/client/framing/QueueBind.cs b/projects/RabbitMQ.Client/client/framing/QueueBind.cs index fe660cbde9..4fb7164341 100644 --- a/projects/RabbitMQ.Client/client/framing/QueueBind.cs +++ b/projects/RabbitMQ.Client/client/framing/QueueBind.cs @@ -35,8 +35,7 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. - internal sealed class QueueBind : Client.Impl.MethodBase + internal sealed class QueueBind : MethodBase { public ushort _reserved1; public string _queue; @@ -45,22 +44,18 @@ internal sealed class QueueBind : Client.Impl.MethodBase public bool _nowait; public IDictionary _arguments; - ushort Reserved1 => _reserved1; - string Queue => _queue; - string Exchange => _exchange; - string RoutingKey => _routingKey; - bool Nowait => _nowait; - IDictionary Arguments => _arguments; + public QueueBind() + { + } - public QueueBind() {} - public QueueBind(ushort @Reserved1, string @Queue, string @Exchange, string @RoutingKey, bool @Nowait, IDictionary @Arguments) + public QueueBind(ushort Reserved1, string Queue, string Exchange, string RoutingKey, bool Nowait, IDictionary Arguments) { - _reserved1 = @Reserved1; - _queue = @Queue; - _exchange = @Exchange; - _routingKey = @RoutingKey; - _nowait = @Nowait; - _arguments = @Arguments; + _reserved1 = Reserved1; + _queue = Queue; + _exchange = Exchange; + _routingKey = RoutingKey; + _nowait = Nowait; + _arguments = Arguments; } public override ushort ProtocolClassId => ClassConstants.Queue; @@ -68,7 +63,7 @@ public QueueBind(ushort @Reserved1, string @Queue, string @Exchange, string @Rou public override string ProtocolMethodName => "queue.bind"; public override bool HasContent => false; - public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + public override void ReadArgumentsFrom(ref MethodArgumentReader reader) { _reserved1 = reader.ReadShort(); _queue = reader.ReadShortstr(); @@ -78,7 +73,7 @@ public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader read _arguments = reader.ReadTable(); } - public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + public override void WriteArgumentsTo(ref MethodArgumentWriter writer) { writer.WriteShort(_reserved1); writer.WriteShortstr(_queue); @@ -91,24 +86,12 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 6; // bytes for _reserved1, length of _queue, length of _exchange, length of _routingKey, bit fields + int bufferSize = 2 + 1 + 1 + 1 + 1; // bytes for _reserved1, length of _queue, length of _exchange, length of _routingKey, bit fields bufferSize += Encoding.UTF8.GetByteCount(_queue); // _queue in bytes bufferSize += Encoding.UTF8.GetByteCount(_exchange); // _exchange in bytes bufferSize += Encoding.UTF8.GetByteCount(_routingKey); // _routingKey in bytes bufferSize += WireFormatting.GetTableByteCount(_arguments); // _arguments in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_reserved1).Append(','); - sb.Append(_queue).Append(','); - sb.Append(_exchange).Append(','); - sb.Append(_routingKey).Append(','); - sb.Append(_nowait).Append(','); - sb.Append(_arguments); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/QueueBindOk.cs b/projects/RabbitMQ.Client/client/framing/QueueBindOk.cs index dfc4247d9e..a468398af3 100644 --- a/projects/RabbitMQ.Client/client/framing/QueueBindOk.cs +++ b/projects/RabbitMQ.Client/client/framing/QueueBindOk.cs @@ -29,15 +29,10 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class QueueBindOk : Client.Impl.MethodBase { - - public QueueBindOk() { } @@ -57,14 +52,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 0; - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(')'); + return 0; } } } diff --git a/projects/RabbitMQ.Client/client/framing/QueueDeclare.cs b/projects/RabbitMQ.Client/client/framing/QueueDeclare.cs index 06a40226fb..efa6a126ef 100644 --- a/projects/RabbitMQ.Client/client/framing/QueueDeclare.cs +++ b/projects/RabbitMQ.Client/client/framing/QueueDeclare.cs @@ -35,8 +35,7 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. - internal sealed class QueueDeclare : Client.Impl.MethodBase + internal sealed class QueueDeclare : MethodBase { public ushort _reserved1; public string _queue; @@ -47,26 +46,20 @@ internal sealed class QueueDeclare : Client.Impl.MethodBase public bool _nowait; public IDictionary _arguments; - ushort Reserved1 => _reserved1; - string Queue => _queue; - bool Passive => _passive; - bool Durable => _durable; - bool Exclusive => _exclusive; - bool AutoDelete => _autoDelete; - bool Nowait => _nowait; - IDictionary Arguments => _arguments; + public QueueDeclare() + { + } - public QueueDeclare() {} - public QueueDeclare(ushort @Reserved1, string @Queue, bool @Passive, bool @Durable, bool @Exclusive, bool @AutoDelete, bool @Nowait, IDictionary @Arguments) + public QueueDeclare(ushort Reserved1, string Queue, bool Passive, bool Durable, bool Exclusive, bool AutoDelete, bool Nowait, IDictionary Arguments) { - _reserved1 = @Reserved1; - _queue = @Queue; - _passive = @Passive; - _durable = @Durable; - _exclusive = @Exclusive; - _autoDelete = @AutoDelete; - _nowait = @Nowait; - _arguments = @Arguments; + _reserved1 = Reserved1; + _queue = Queue; + _passive = Passive; + _durable = Durable; + _exclusive = Exclusive; + _autoDelete = AutoDelete; + _nowait = Nowait; + _arguments = Arguments; } public override ushort ProtocolClassId => ClassConstants.Queue; @@ -74,7 +67,7 @@ public QueueDeclare(ushort @Reserved1, string @Queue, bool @Passive, bool @Durab public override string ProtocolMethodName => "queue.declare"; public override bool HasContent => false; - public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + public override void ReadArgumentsFrom(ref MethodArgumentReader reader) { _reserved1 = reader.ReadShort(); _queue = reader.ReadShortstr(); @@ -86,7 +79,7 @@ public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader read _arguments = reader.ReadTable(); } - public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + public override void WriteArgumentsTo(ref MethodArgumentWriter writer) { writer.WriteShort(_reserved1); writer.WriteShortstr(_queue); @@ -101,24 +94,10 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 4; // bytes for _reserved1, length of _queue, bit fields + int bufferSize = 2 + 1 + 1; // bytes for _reserved1, length of _queue, bit fields bufferSize += Encoding.UTF8.GetByteCount(_queue); // _queue in bytes bufferSize += WireFormatting.GetTableByteCount(_arguments); // _arguments in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_reserved1).Append(','); - sb.Append(_queue).Append(','); - sb.Append(_passive).Append(','); - sb.Append(_durable).Append(','); - sb.Append(_exclusive).Append(','); - sb.Append(_autoDelete).Append(','); - sb.Append(_nowait).Append(','); - sb.Append(_arguments); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/QueueDeclareOk.cs b/projects/RabbitMQ.Client/client/framing/QueueDeclareOk.cs index 4a6ebeccb1..85bc41767c 100644 --- a/projects/RabbitMQ.Client/client/framing/QueueDeclareOk.cs +++ b/projects/RabbitMQ.Client/client/framing/QueueDeclareOk.cs @@ -33,23 +33,21 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class QueueDeclareOk : Client.Impl.MethodBase { public string _queue; public uint _messageCount; public uint _consumerCount; - string Queue => _queue; - uint MessageCount => _messageCount; - uint ConsumerCount => _consumerCount; + public QueueDeclareOk() + { + } - public QueueDeclareOk() {} - public QueueDeclareOk(string @Queue, uint @MessageCount, uint @ConsumerCount) + public QueueDeclareOk(string Queue, uint MessageCount, uint ConsumerCount) { - _queue = @Queue; - _messageCount = @MessageCount; - _consumerCount = @ConsumerCount; + _queue = Queue; + _messageCount = MessageCount; + _consumerCount = ConsumerCount; } public override ushort ProtocolClassId => ClassConstants.Queue; @@ -73,18 +71,9 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 9; // bytes for length of _queue, _messageCount, _consumerCount + int bufferSize = 1 + 4 + 4; // bytes for length of _queue, _messageCount, _consumerCount bufferSize += Encoding.UTF8.GetByteCount(_queue); // _queue in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_queue).Append(','); - sb.Append(_messageCount).Append(','); - sb.Append(_consumerCount); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/QueueDelete.cs b/projects/RabbitMQ.Client/client/framing/QueueDelete.cs index a122a353ea..64cc5e14a0 100644 --- a/projects/RabbitMQ.Client/client/framing/QueueDelete.cs +++ b/projects/RabbitMQ.Client/client/framing/QueueDelete.cs @@ -33,7 +33,6 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class QueueDelete : Client.Impl.MethodBase { public ushort _reserved1; @@ -42,20 +41,17 @@ internal sealed class QueueDelete : Client.Impl.MethodBase public bool _ifEmpty; public bool _nowait; - ushort Reserved1 => _reserved1; - string Queue => _queue; - bool IfUnused => _ifUnused; - bool IfEmpty => _ifEmpty; - bool Nowait => _nowait; + public QueueDelete() + { + } - public QueueDelete() {} - public QueueDelete(ushort @Reserved1, string @Queue, bool @IfUnused, bool @IfEmpty, bool @Nowait) + public QueueDelete(ushort Reserved1, string Queue, bool IfUnused, bool IfEmpty, bool Nowait) { - _reserved1 = @Reserved1; - _queue = @Queue; - _ifUnused = @IfUnused; - _ifEmpty = @IfEmpty; - _nowait = @Nowait; + _reserved1 = Reserved1; + _queue = Queue; + _ifUnused = IfUnused; + _ifEmpty = IfEmpty; + _nowait = Nowait; } public override ushort ProtocolClassId => ClassConstants.Queue; @@ -84,20 +80,9 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 4; // bytes for _reserved1, length of _queue, bit fields + int bufferSize = 2 + 1 + 1; // bytes for _reserved1, length of _queue, bit fields bufferSize += Encoding.UTF8.GetByteCount(_queue); // _queue in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_reserved1).Append(','); - sb.Append(_queue).Append(','); - sb.Append(_ifUnused).Append(','); - sb.Append(_ifEmpty).Append(','); - sb.Append(_nowait); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/QueueDeleteOk.cs b/projects/RabbitMQ.Client/client/framing/QueueDeleteOk.cs index e9e7e46838..81580cc5da 100644 --- a/projects/RabbitMQ.Client/client/framing/QueueDeleteOk.cs +++ b/projects/RabbitMQ.Client/client/framing/QueueDeleteOk.cs @@ -29,21 +29,19 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class QueueDeleteOk : Client.Impl.MethodBase { public uint _messageCount; - uint MessageCount => _messageCount; + public QueueDeleteOk() + { + } - public QueueDeleteOk() {} - public QueueDeleteOk(uint @MessageCount) + public QueueDeleteOk(uint MessageCount) { - _messageCount = @MessageCount; + _messageCount = MessageCount; } public override ushort ProtocolClassId => ClassConstants.Queue; @@ -63,15 +61,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 4; // bytes for _messageCount - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_messageCount); - sb.Append(')'); + return 4; // bytes for _messageCount } } } diff --git a/projects/RabbitMQ.Client/client/framing/QueuePurge.cs b/projects/RabbitMQ.Client/client/framing/QueuePurge.cs index 9aee86e622..a7abb17483 100644 --- a/projects/RabbitMQ.Client/client/framing/QueuePurge.cs +++ b/projects/RabbitMQ.Client/client/framing/QueuePurge.cs @@ -33,23 +33,21 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class QueuePurge : Client.Impl.MethodBase { public ushort _reserved1; public string _queue; public bool _nowait; - ushort Reserved1 => _reserved1; - string Queue => _queue; - bool Nowait => _nowait; + public QueuePurge() + { + } - public QueuePurge() {} - public QueuePurge(ushort @Reserved1, string @Queue, bool @Nowait) + public QueuePurge(ushort Reserved1, string Queue, bool Nowait) { - _reserved1 = @Reserved1; - _queue = @Queue; - _nowait = @Nowait; + _reserved1 = Reserved1; + _queue = Queue; + _nowait = Nowait; } public override ushort ProtocolClassId => ClassConstants.Queue; @@ -74,18 +72,9 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 4; // bytes for _reserved1, length of _queue, bit fields + int bufferSize = 2 + 1 + 1; // bytes for _reserved1, length of _queue, bit fields bufferSize += Encoding.UTF8.GetByteCount(_queue); // _queue in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_reserved1).Append(','); - sb.Append(_queue).Append(','); - sb.Append(_nowait); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/QueuePurgeOk.cs b/projects/RabbitMQ.Client/client/framing/QueuePurgeOk.cs index 90cb2008db..90ab57791b 100644 --- a/projects/RabbitMQ.Client/client/framing/QueuePurgeOk.cs +++ b/projects/RabbitMQ.Client/client/framing/QueuePurgeOk.cs @@ -29,21 +29,19 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class QueuePurgeOk : Client.Impl.MethodBase { public uint _messageCount; - uint MessageCount => _messageCount; + public QueuePurgeOk() + { + } - public QueuePurgeOk() {} - public QueuePurgeOk(uint @MessageCount) + public QueuePurgeOk(uint MessageCount) { - _messageCount = @MessageCount; + _messageCount = MessageCount; } public override ushort ProtocolClassId => ClassConstants.Queue; @@ -63,15 +61,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 4; // bytes for _messageCount - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_messageCount); - sb.Append(')'); + return 4; // bytes for _messageCount } } } diff --git a/projects/RabbitMQ.Client/client/framing/QueueUnbind.cs b/projects/RabbitMQ.Client/client/framing/QueueUnbind.cs index 989f383728..2d036d41b2 100644 --- a/projects/RabbitMQ.Client/client/framing/QueueUnbind.cs +++ b/projects/RabbitMQ.Client/client/framing/QueueUnbind.cs @@ -35,8 +35,7 @@ namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. - internal sealed class QueueUnbind : Client.Impl.MethodBase + internal sealed class QueueUnbind : MethodBase { public ushort _reserved1; public string _queue; @@ -44,20 +43,17 @@ internal sealed class QueueUnbind : Client.Impl.MethodBase public string _routingKey; public IDictionary _arguments; - ushort Reserved1 => _reserved1; - string Queue => _queue; - string Exchange => _exchange; - string RoutingKey => _routingKey; - IDictionary Arguments => _arguments; + public QueueUnbind() + { + } - public QueueUnbind() {} - public QueueUnbind(ushort @Reserved1, string @Queue, string @Exchange, string @RoutingKey, IDictionary @Arguments) + public QueueUnbind(ushort Reserved1, string Queue, string Exchange, string RoutingKey, IDictionary Arguments) { - _reserved1 = @Reserved1; - _queue = @Queue; - _exchange = @Exchange; - _routingKey = @RoutingKey; - _arguments = @Arguments; + _reserved1 = Reserved1; + _queue = Queue; + _exchange = Exchange; + _routingKey = RoutingKey; + _arguments = Arguments; } public override ushort ProtocolClassId => ClassConstants.Queue; @@ -65,7 +61,7 @@ public QueueUnbind(ushort @Reserved1, string @Queue, string @Exchange, string @R public override string ProtocolMethodName => "queue.unbind"; public override bool HasContent => false; - public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader reader) + public override void ReadArgumentsFrom(ref MethodArgumentReader reader) { _reserved1 = reader.ReadShort(); _queue = reader.ReadShortstr(); @@ -74,7 +70,7 @@ public override void ReadArgumentsFrom(ref Client.Impl.MethodArgumentReader read _arguments = reader.ReadTable(); } - public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter writer) + public override void WriteArgumentsTo(ref MethodArgumentWriter writer) { writer.WriteShort(_reserved1); writer.WriteShortstr(_queue); @@ -85,23 +81,12 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 5; // bytes for _reserved1, length of _queue, length of _exchange, length of _routingKey + int bufferSize = 2 + 1 + 1 + 1; // bytes for _reserved1, length of _queue, length of _exchange, length of _routingKey bufferSize += Encoding.UTF8.GetByteCount(_queue); // _queue in bytes bufferSize += Encoding.UTF8.GetByteCount(_exchange); // _exchange in bytes bufferSize += Encoding.UTF8.GetByteCount(_routingKey); // _routingKey in bytes bufferSize += WireFormatting.GetTableByteCount(_arguments); // _arguments in bytes return bufferSize; } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(_reserved1).Append(','); - sb.Append(_queue).Append(','); - sb.Append(_exchange).Append(','); - sb.Append(_routingKey).Append(','); - sb.Append(_arguments); - sb.Append(')'); - } } } diff --git a/projects/RabbitMQ.Client/client/framing/QueueUnbindOk.cs b/projects/RabbitMQ.Client/client/framing/QueueUnbindOk.cs index 5ab977f24c..9f56bbc904 100644 --- a/projects/RabbitMQ.Client/client/framing/QueueUnbindOk.cs +++ b/projects/RabbitMQ.Client/client/framing/QueueUnbindOk.cs @@ -29,15 +29,10 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class QueueUnbindOk : Client.Impl.MethodBase { - - public QueueUnbindOk() { } @@ -57,14 +52,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 0; - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(')'); + return 0; } } } diff --git a/projects/RabbitMQ.Client/client/framing/TxCommit.cs b/projects/RabbitMQ.Client/client/framing/TxCommit.cs index 571d6573aa..04d0fa199e 100644 --- a/projects/RabbitMQ.Client/client/framing/TxCommit.cs +++ b/projects/RabbitMQ.Client/client/framing/TxCommit.cs @@ -29,15 +29,10 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class TxCommit : Client.Impl.MethodBase { - - public TxCommit() { } @@ -57,14 +52,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 0; - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(')'); + return 0; } } } diff --git a/projects/RabbitMQ.Client/client/framing/TxCommitOk.cs b/projects/RabbitMQ.Client/client/framing/TxCommitOk.cs index 0c445fc280..05b852515b 100644 --- a/projects/RabbitMQ.Client/client/framing/TxCommitOk.cs +++ b/projects/RabbitMQ.Client/client/framing/TxCommitOk.cs @@ -29,15 +29,10 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class TxCommitOk : Client.Impl.MethodBase { - - public TxCommitOk() { } @@ -57,14 +52,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 0; - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(')'); + return 0; } } } diff --git a/projects/RabbitMQ.Client/client/framing/TxRollback.cs b/projects/RabbitMQ.Client/client/framing/TxRollback.cs index d3c321dd10..cee9134e9a 100644 --- a/projects/RabbitMQ.Client/client/framing/TxRollback.cs +++ b/projects/RabbitMQ.Client/client/framing/TxRollback.cs @@ -29,15 +29,10 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class TxRollback : Client.Impl.MethodBase { - - public TxRollback() { } @@ -57,14 +52,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 0; - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(')'); + return 0; } } } diff --git a/projects/RabbitMQ.Client/client/framing/TxRollbackOk.cs b/projects/RabbitMQ.Client/client/framing/TxRollbackOk.cs index 5a1d15d90c..fc144b8bdd 100644 --- a/projects/RabbitMQ.Client/client/framing/TxRollbackOk.cs +++ b/projects/RabbitMQ.Client/client/framing/TxRollbackOk.cs @@ -29,15 +29,10 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class TxRollbackOk : Client.Impl.MethodBase { - - public TxRollbackOk() { } @@ -57,14 +52,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 0; - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(')'); + return 0; } } } diff --git a/projects/RabbitMQ.Client/client/framing/TxSelect.cs b/projects/RabbitMQ.Client/client/framing/TxSelect.cs index 247b5fcd23..8a194131a6 100644 --- a/projects/RabbitMQ.Client/client/framing/TxSelect.cs +++ b/projects/RabbitMQ.Client/client/framing/TxSelect.cs @@ -29,15 +29,10 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class TxSelect : Client.Impl.MethodBase { - - public TxSelect() { } @@ -57,14 +52,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 0; - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(')'); + return 0; } } } diff --git a/projects/RabbitMQ.Client/client/framing/TxSelectOk.cs b/projects/RabbitMQ.Client/client/framing/TxSelectOk.cs index 4145e817ca..936010025f 100644 --- a/projects/RabbitMQ.Client/client/framing/TxSelectOk.cs +++ b/projects/RabbitMQ.Client/client/framing/TxSelectOk.cs @@ -29,15 +29,10 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Framing.Impl { - /// Autogenerated type. Private implementation class - do not use directly. internal sealed class TxSelectOk : Client.Impl.MethodBase { - - public TxSelectOk() { } @@ -57,14 +52,7 @@ public override void WriteArgumentsTo(ref Client.Impl.MethodArgumentWriter write public override int GetRequiredBufferSize() { - int bufferSize = 0; - return bufferSize; - } - - public override void AppendArgumentDebugStringTo(StringBuilder sb) - { - sb.Append('('); - sb.Append(')'); + return 0; } } } diff --git a/projects/RabbitMQ.Client/client/impl/ContentHeaderBase.cs b/projects/RabbitMQ.Client/client/impl/ContentHeaderBase.cs index 62144d0563..b9c2592693 100644 --- a/projects/RabbitMQ.Client/client/impl/ContentHeaderBase.cs +++ b/projects/RabbitMQ.Client/client/impl/ContentHeaderBase.cs @@ -30,11 +30,10 @@ //--------------------------------------------------------------------------- using System; -using System.Text; namespace RabbitMQ.Client.Impl { - abstract class ContentHeaderBase : IContentHeader + internal abstract class ContentHeaderBase : IContentHeader { /// /// Retrieve the AMQP class ID of this content header. @@ -51,8 +50,6 @@ public virtual object Clone() throw new NotImplementedException(); } - public abstract void AppendPropertyDebugStringTo(StringBuilder stringBuilder); - /// /// Fill this instance from the given byte buffer stream. /// diff --git a/projects/RabbitMQ.Client/client/impl/IFullModel.cs b/projects/RabbitMQ.Client/client/impl/IFullModel.cs index 35cd7a3636..157d86ee1e 100644 --- a/projects/RabbitMQ.Client/client/impl/IFullModel.cs +++ b/projects/RabbitMQ.Client/client/impl/IFullModel.cs @@ -32,8 +32,6 @@ using System; using System.Collections.Generic; -using RabbitMQ.Client.Apigen.Attributes; - namespace RabbitMQ.Client.Impl { ///Not part of the public API. Extension of IModel to @@ -51,13 +49,11 @@ namespace RabbitMQ.Client.Impl /// /// /// - interface IFullModel : IModel + internal interface IFullModel : IModel { ///Sends a Connection.TuneOk. Used during connection ///initialisation. - void ConnectionTuneOk(ushort channelMax, - uint frameMax, - ushort heartbeat); + void ConnectionTuneOk(ushort channelMax, uint frameMax, ushort heartbeat); ///Handle incoming Basic.Deliver methods. Dispatches ///to waiting consumers. @@ -66,9 +62,9 @@ void HandleBasicDeliver(string consumerTag, bool redelivered, string exchange, string routingKey, - [AmqpContentHeaderMapping] IBasicProperties basicProperties, - [AmqpContentBodyMapping] ReadOnlyMemory body, - [AmqpContentBodyArrayMapping] byte[] rentedArray); + IBasicProperties basicProperties, + ReadOnlyMemory body, + byte[] rentedArray); ///Handle incoming Basic.Ack methods. Signals a ///BasicAckEvent. @@ -98,15 +94,13 @@ void HandleBasicGetOk(ulong deliveryTag, string exchange, string routingKey, uint messageCount, - [AmqpContentHeaderMapping] IBasicProperties basicProperties, - [AmqpContentBodyMapping] ReadOnlyMemory body, - [AmqpContentBodyArrayMapping] byte[] rentedArray); + IBasicProperties basicProperties, + ReadOnlyMemory body, + byte[] rentedArray); ///Handle incoming Basic.Nack methods. Signals a ///BasicNackEvent. - void HandleBasicNack(ulong deliveryTag, - bool multiple, - bool requeue); + void HandleBasicNack(ulong deliveryTag, bool multiple, bool requeue); ///Handle incoming Basic.RecoverOk methods ///received in reply to Basic.Recover. @@ -119,16 +113,13 @@ void HandleBasicReturn(ushort replyCode, string replyText, string exchange, string routingKey, - [AmqpContentHeaderMapping] IBasicProperties basicProperties, - [AmqpContentBodyMapping] ReadOnlyMemory body, - [AmqpContentBodyArrayMapping] byte[] takeoverPayload); + IBasicProperties basicProperties, + ReadOnlyMemory body, + byte[] takeoverPayload); ///Handle an incoming Channel.Close. Shuts down the ///session and model. - void HandleChannelClose(ushort replyCode, - string replyText, - ushort classId, - ushort methodId); + void HandleChannelClose(ushort replyCode, string replyText, ushort classId, ushort methodId); ///Handle an incoming Channel.CloseOk. void HandleChannelCloseOk(); @@ -138,18 +129,14 @@ void HandleChannelClose(ushort replyCode, void HandleChannelFlow(bool active); ///Handle an incoming Connection.Blocked. - [AmqpMethodMapping(null, "connection", "blocked")] void HandleConnectionBlocked(string reason); ///Handle an incoming Connection.Close. Shuts down the ///connection and all sessions and models. - void HandleConnectionClose(ushort replyCode, - string replyText, - ushort classId, - ushort methodId); + void HandleConnectionClose(ushort replyCode, string replyText, ushort classId, ushort methodId); ///Handle an incoming Connection.OpenOk. - void HandleConnectionOpenOk([AmqpFieldMapping("RabbitMQ.Client.Framing", "reserved1")] string knownHosts); + void HandleConnectionOpenOk(string knownHosts); /////////////////////////////////////////////////////////////////////////// // Connection-related methods, for use in channel 0 during @@ -161,227 +148,141 @@ void HandleConnectionClose(ushort replyCode, ///Handle an incoming Connection.Start. Used during ///connection initialisation. - void HandleConnectionStart(byte versionMajor, - byte versionMinor, - IDictionary serverProperties, - byte[] mechanisms, - byte[] locales); + void HandleConnectionStart(byte versionMajor, byte versionMinor, IDictionary serverProperties, byte[] mechanisms, byte[] locales); ///Handle incoming Connection.Tune ///methods. - void HandleConnectionTune(ushort channelMax, - uint frameMax, - ushort heartbeat); + void HandleConnectionTune(ushort channelMax, uint frameMax, ushort heartbeat); ///Handle an incominga Connection.Unblocked. void HandleConnectionUnblocked(); ///Handle incoming Queue.DeclareOk methods. Routes the ///information to a waiting Queue.DeclareOk continuation. - void HandleQueueDeclareOk(string queue, - uint messageCount, - uint consumerCount); + void HandleQueueDeclareOk(string queue, uint messageCount, uint consumerCount); ///Used to send a Basic.Cancel method. The public ///consume API calls this while also managing internal ///datastructures. - [AmqpForceOneWay] - [AmqpMethodMapping(null, "basic", "cancel")] - void _Private_BasicCancel(string consumerTag, - bool nowait); + void _Private_BasicCancel(string consumerTag, bool nowait); ///Used to send a Basic.Consume method. The public ///consume API calls this while also managing internal ///datastructures. - [AmqpForceOneWay] - [AmqpMethodMapping(null, "basic", "consume")] - void _Private_BasicConsume(string queue, - string consumerTag, - bool noLocal, - [AmqpFieldMapping(null, "noAck")] bool autoAck, - bool exclusive, - bool nowait, - IDictionary arguments); + void _Private_BasicConsume(string queue, string consumerTag, bool noLocal, bool autoAck, bool exclusive, bool nowait, IDictionary arguments); ///Used to send a Basic.Get. Basic.Get is a special ///case, since it can result in a Basic.GetOk or a ///Basic.GetEmpty, so this level of manual control is ///required. - [AmqpForceOneWay] - [AmqpMethodMapping(null, "basic", "get")] - void _Private_BasicGet(string queue, - [AmqpFieldMapping(null, "noAck")] bool autoAck); + void _Private_BasicGet(string queue, bool autoAck); ///Used to send a Basic.Publish method. Called by the ///public publish method after potential null-reference issues ///have been rectified. - [AmqpMethodMapping(null, "basic", "publish")] - void _Private_BasicPublish(string exchange, - string routingKey, - bool mandatory, - [AmqpContentHeaderMapping] IBasicProperties basicProperties, - [AmqpContentBodyMapping] ReadOnlyMemory body); + void _Private_BasicPublish(string exchange, string routingKey, bool mandatory, IBasicProperties basicProperties, ReadOnlyMemory body); - [AmqpForceOneWay] - [AmqpMethodMapping(null, "basic", "recover")] void _Private_BasicRecover(bool requeue); ///Used to send a Channel.Close. Called during ///session shutdown. - [AmqpForceOneWay] - [AmqpMethodMapping(null, "channel", "close")] - void _Private_ChannelClose(ushort replyCode, - string replyText, - ushort classId, - ushort methodId); + void _Private_ChannelClose(ushort replyCode, string replyText, ushort classId, ushort methodId); ///Used to send a Channel.CloseOk. Called during ///session shutdown. - [AmqpMethodMapping(null, "channel", "close-ok")] void _Private_ChannelCloseOk(); ///Used to send a Channel.FlowOk. Confirms that ///Channel.Flow from the broker was processed. - [AmqpMethodMapping(null, "channel", "flow-ok")] void _Private_ChannelFlowOk(bool active); ///Used to send a Channel.Open. Called during session ///initialisation. - [AmqpMethodMapping(null, "channel", "open")] - void _Private_ChannelOpen([AmqpFieldMapping("RabbitMQ.Client.Framing", - "reserved1")] string outOfBand); + void _Private_ChannelOpen(string outOfBand); ///Used to send a Confirm.Select method. The public ///confirm API calls this while also managing internal ///datastructures. - [AmqpMethodMapping(null, "confirm", "select")] - void _Private_ConfirmSelect([AmqpNowaitArgument(null)] bool nowait); + void _Private_ConfirmSelect(bool nowait); ///Used to send a Connection.Close. Called during ///connection shutdown. - [AmqpMethodMapping(null, "connection", "close")] - void _Private_ConnectionClose(ushort replyCode, - string replyText, - ushort classId, - ushort methodId); + void _Private_ConnectionClose(ushort replyCode, string replyText, ushort classId, ushort methodId); ///Used to send a Connection.CloseOk. Called during ///connection shutdown. - [AmqpMethodMapping(null, "connection", "close-ok")] void _Private_ConnectionCloseOk(); ///Used to send a Connection.Open. Called during ///connection startup. - [AmqpForceOneWay] - [AmqpMethodMapping(null, "connection", "open")] - void _Private_ConnectionOpen(string virtualHost, - [AmqpFieldMapping("RabbitMQ.Client.Framing", "reserved1")] string capabilities, - [AmqpFieldMapping("RabbitMQ.Client.Framing", "reserved2")] bool insist); + void _Private_ConnectionOpen(string virtualHost, string capabilities, bool insist); ///Used to send a Connection.SecureOk. Again, this is ///special, like Basic.Get. - [AmqpForceOneWay] - [AmqpMethodMapping(null, "connection", "secure-ok")] void _Private_ConnectionSecureOk(byte[] response); ///Used to send a Connection.StartOk. This is ///special, like Basic.Get. - [AmqpForceOneWay] - [AmqpMethodMapping(null, "connection", "start-ok")] - void _Private_ConnectionStartOk(IDictionary clientProperties, - string mechanism, - byte[] response, - string locale); + void _Private_ConnectionStartOk(IDictionary clientProperties, string mechanism, byte[] response, string locale); ///Used to send a Conection.UpdateSecret method. Called by the ///public UpdateSecret method. /// - [AmqpMethodMapping(null, "connection", "update-secret")] void _Private_UpdateSecret(byte[] newSecret, string reason); ///Used to send a Exchange.Bind method. Called by the ///public bind method. /// - [AmqpMethodMapping(null, "exchange", "bind")] - void _Private_ExchangeBind(string destination, - string source, - string routingKey, - [AmqpNowaitArgument(null)] bool nowait, - IDictionary arguments); + void _Private_ExchangeBind(string destination, string source, string routingKey, bool nowait, IDictionary arguments); ///Used to send a Exchange.Declare method. Called by the ///public declare method. /// - [AmqpMethodMapping(null, "exchange", "declare")] void _Private_ExchangeDeclare(string exchange, string type, bool passive, bool durable, bool autoDelete, bool @internal, - [AmqpNowaitArgument(null)] bool nowait, + bool nowait, IDictionary arguments); ///Used to send a Exchange.Delete method. Called by the ///public delete method. /// - [AmqpMethodMapping(null, "exchange", "delete")] - void _Private_ExchangeDelete(string exchange, - bool ifUnused, - [AmqpNowaitArgument(null)] bool nowait); + void _Private_ExchangeDelete(string exchange, bool ifUnused, bool nowait); ///Used to send a Exchange.Unbind method. Called by the ///public unbind method. /// - [AmqpMethodMapping(null, "exchange", "unbind")] - void _Private_ExchangeUnbind(string destination, - string source, - string routingKey, - [AmqpNowaitArgument(null)] bool nowait, - IDictionary arguments); + void _Private_ExchangeUnbind(string destination, string source, string routingKey, bool nowait, IDictionary arguments); ///Used to send a Queue.Bind method. Called by the ///public bind method. - [AmqpMethodMapping(null, "queue", "bind")] - void _Private_QueueBind(string queue, - string exchange, - string routingKey, - [AmqpNowaitArgument(null)] bool nowait, - IDictionary arguments); + void _Private_QueueBind(string queue, string exchange, string routingKey, bool nowait, IDictionary arguments); ///Used to send a Queue.Declare method. Called by the ///public declare method. - [AmqpMethodMapping(null, "queue", "declare")] - [AmqpForceOneWay] void _Private_QueueDeclare(string queue, bool passive, bool durable, bool exclusive, bool autoDelete, - [AmqpNowaitArgument(null)] bool nowait, + bool nowait, IDictionary arguments); ///Used to send a Queue.Delete method. Called by the ///public delete method. - [AmqpMethodMapping(null, "queue", "delete")] - [return: AmqpFieldMapping(null, "messageCount")] - uint _Private_QueueDelete(string queue, - bool ifUnused, - bool ifEmpty, - [AmqpNowaitArgument(null, "0xFFFFFFFF")] bool nowait); + uint _Private_QueueDelete(string queue, bool ifUnused, bool ifEmpty, bool nowait); ///Used to send a Queue.Purge method. Called by the ///public purge method. - [return: AmqpFieldMapping(null, "messageCount")] - [AmqpMethodMapping(null, "queue", "purge")] - uint _Private_QueuePurge(string queue, - [AmqpNowaitArgument(null, "0xFFFFFFFF")] bool nowait); + uint _Private_QueuePurge(string queue, bool nowait); } - ///Essential information from an incoming Connection.Tune ///method. - struct ConnectionTuneDetails + internal struct ConnectionTuneDetails { ///The peer's suggested channel-max parameter. public ushort m_channelMax; @@ -394,181 +295,9 @@ struct ConnectionTuneDetails } - class ConnectionSecureOrTune + internal class ConnectionSecureOrTune { public byte[] m_challenge; public ConnectionTuneDetails m_tuneDetails; } } - -namespace RabbitMQ.Client.Apigen.Attributes -{ - ///Base class for attributes for controlling the API - ///autogeneration process. - abstract class AmqpApigenAttribute : Attribute - { - ///The specification namespace (i.e. version) that - ///this attribute applies to, or null for all specification - ///versions. - public string m_namespaceName; - - public AmqpApigenAttribute(string namespaceName) - { - m_namespaceName = namespaceName; - } - } - - - ///Causes the API generator to ignore the attributed method. - /// - ///Mostly used to declare convenience overloads of - ///various AMQP methods in the IModel interface. Also used - ///to omit an autogenerated implementation of a method which - ///is not required for one protocol version. The API - ///autogeneration process should of course not attempt to produce - ///an implementation of the convenience methods, as they will be - ///implemented by hand with sensible defaults, delegating to the - ///autogenerated variant of the method concerned. - [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] - class AmqpMethodDoNotImplementAttribute : AmqpApigenAttribute - { - public AmqpMethodDoNotImplementAttribute(string namespaceName) - : base(namespaceName) - { - } - } - - - ///Causes the API generator to generate asynchronous - ///receive code for the attributed method. - [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] - class AmqpAsynchronousHandlerAttribute : AmqpApigenAttribute - { - public AmqpAsynchronousHandlerAttribute(string namespaceName) - : base(namespaceName) - { - } - } - - - ///Causes the API generator to generate - ///exception-throwing code for, instead of simply ignoring, the - ///attributed method. - /// - /// - [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] - class AmqpUnsupportedAttribute : AmqpApigenAttribute - { - public AmqpUnsupportedAttribute(string namespaceName) - : base(namespaceName) - { - } - } - - - ///Informs the API generator which AMQP method field to - ///use for either a parameter in a request, or for a simple result - ///in a reply. - [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] - class AmqpFieldMappingAttribute : AmqpApigenAttribute - { - public string m_fieldName; - - public AmqpFieldMappingAttribute(string namespaceName, - string fieldName) - : base(namespaceName) - { - m_fieldName = fieldName; - } - } - - - ///Informs the API generator which AMQP method to use for - ///either a request (if applied to an IModel method) or a reply - ///(if applied to an IModel method result). - [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] - class AmqpMethodMappingAttribute : AmqpApigenAttribute - { - public string m_className; - public string m_methodName; - - public AmqpMethodMappingAttribute(string namespaceName, - string className, - string methodName) - : base(namespaceName) - { - m_className = className; - m_methodName = methodName; - } - } - - - ///This attribute, if placed on a parameter in an IModel - ///method, causes it to be interpreted as a "nowait" parameter for - ///the purposes of autogenerated RPC reply continuation management - ///and control. - [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] - class AmqpNowaitArgumentAttribute : AmqpApigenAttribute - { - public string m_replacementExpression; - - public AmqpNowaitArgumentAttribute(string namespaceName) - : this(namespaceName, null) - { - } - - public AmqpNowaitArgumentAttribute(string namespaceName, - string replacementExpression) - : base(namespaceName) - { - m_replacementExpression = replacementExpression; - } - } - - - ///This attribute, if placed on a method in IModel, - ///causes the method to be interpreted as a factory method - ///producing a protocol-specific implementation of a common - ///content header interface. - class AmqpContentHeaderFactoryAttribute : Attribute - { - public string m_contentClass; - - public AmqpContentHeaderFactoryAttribute(string contentClass) - { - m_contentClass = contentClass; - } - } - - - ///This attribute, if placed on a parameter in a - ///content-carrying IModel method, causes it to be sent as part of - ///the content header frame. - class AmqpContentHeaderMappingAttribute : Attribute - { - } - - - ///This attribute, if placed on a parameter in a - ///content-carrying IModel method, causes it to be sent as part of - ///the content body frame. - class AmqpContentBodyMappingAttribute : Attribute - { - } - - ///This attribute, if placed on a parameter in a - ///content-carrying IModel method, causes it to be calling TakeoverPayload. - class AmqpContentBodyArrayMappingAttribute : Attribute - { - } - - - ///This attribute, placed on an IModel method, causes - ///what would normally be an RPC, sent with ModelRpc, to be sent - ///as if it were oneway, with ModelSend. The assumption that this - ///is for a custom continuation (e.g. for BasicConsume/BasicCancel - ///etc.) - class AmqpForceOneWayAttribute : Attribute - { - } -} diff --git a/projects/RabbitMQ.Client/client/impl/MethodBase.cs b/projects/RabbitMQ.Client/client/impl/MethodBase.cs index f4a1e1097d..716b54f1c8 100644 --- a/projects/RabbitMQ.Client/client/impl/MethodBase.cs +++ b/projects/RabbitMQ.Client/client/impl/MethodBase.cs @@ -29,8 +29,6 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- -using System.Text; - namespace RabbitMQ.Client.Impl { abstract class MethodBase : IMethod @@ -52,7 +50,6 @@ abstract class MethodBase : IMethod /// public abstract string ProtocolMethodName { get; } - public abstract void AppendArgumentDebugStringTo(StringBuilder stringBuilder); public abstract void ReadArgumentsFrom(ref MethodArgumentReader reader); public abstract void WriteArgumentsTo(ref MethodArgumentWriter writer); public abstract int GetRequiredBufferSize(); diff --git a/projects/RabbitMQ.Client/client/impl/ModelBase.cs b/projects/RabbitMQ.Client/client/impl/ModelBase.cs index 8f074dfc23..d67da0467b 100644 --- a/projects/RabbitMQ.Client/client/impl/ModelBase.cs +++ b/projects/RabbitMQ.Client/client/impl/ModelBase.cs @@ -330,16 +330,21 @@ public void HandleCommand(in IncomingCommand cmd) } } - public MethodBase ModelRpc(MethodBase method, ContentHeaderBase header, byte[] body) + public MethodBase ModelRpc(MethodBase method) { var k = new SimpleBlockingRpcContinuation(); lock (_rpcLock) { - TransmitAndEnqueue(new OutgoingCommand(method, header, body), k); + TransmitAndEnqueue(new OutgoingCommand(method), k); return k.GetReply(ContinuationTimeout).Method; } } + public void ModelSend(MethodBase method) + { + ModelSend(method, null, ReadOnlyMemory.Empty); + } + public void ModelSend(MethodBase method, ContentHeaderBase header, ReadOnlyMemory body) { if (method.HasContent) From fd1bb55dc8fbacd5c6ec1f144f0def1e155ed483 Mon Sep 17 00:00:00 2001 From: bollhals Date: Sat, 15 Aug 2020 00:38:57 +0200 Subject: [PATCH 3/4] unify rpc calls --- .../RabbitMQ.Client/client/framing/Model.cs | 99 +++---------------- .../RabbitMQ.Client/client/impl/ModelBase.cs | 15 ++- 2 files changed, 28 insertions(+), 86 deletions(-) diff --git a/projects/RabbitMQ.Client/client/framing/Model.cs b/projects/RabbitMQ.Client/client/framing/Model.cs index c50e14e45c..1230ffb334 100644 --- a/projects/RabbitMQ.Client/client/framing/Model.cs +++ b/projects/RabbitMQ.Client/client/framing/Model.cs @@ -31,7 +31,6 @@ using System; using System.Collections.Generic; -using RabbitMQ.Client.Exceptions; using RabbitMQ.Client.Impl; namespace RabbitMQ.Client.Framing.Impl @@ -95,11 +94,7 @@ public override void _Private_ChannelFlowOk(bool active) public override void _Private_ChannelOpen(string outOfBand) { - MethodBase __repBase = ModelRpc(new ChannelOpen(outOfBand)); - if (!(__repBase is ChannelOpenOk)) - { - throw new UnexpectedMethodException(__repBase); - } + ModelRpc(new ChannelOpen(outOfBand)); } public override void _Private_ConfirmSelect(bool nowait) @@ -111,21 +106,13 @@ public override void _Private_ConfirmSelect(bool nowait) } else { - MethodBase __repBase = ModelRpc(method); - if (!(__repBase is ConfirmSelectOk)) - { - throw new UnexpectedMethodException(__repBase); - } + ModelRpc(method); } } public override void _Private_ConnectionClose(ushort replyCode, string replyText, ushort classId, ushort methodId) { - MethodBase __repBase = ModelRpc(new ConnectionClose(replyCode, replyText, classId, methodId)); - if (!(__repBase is ConnectionCloseOk)) - { - throw new UnexpectedMethodException(__repBase); - } + ModelRpc(new ConnectionClose(replyCode, replyText, classId, methodId)); } public override void _Private_ConnectionCloseOk() @@ -150,11 +137,7 @@ public override void _Private_ConnectionStartOk(IDictionary clie public override void _Private_UpdateSecret(byte[] newSecret, string reason) { - MethodBase __repBase = ModelRpc(new ConnectionUpdateSecret(newSecret, reason)); - if (!(__repBase is ConnectionUpdateSecretOk)) - { - throw new UnexpectedMethodException(__repBase); - } + ModelRpc(new ConnectionUpdateSecret(newSecret, reason)); } public override void _Private_ExchangeBind(string destination, string source, string routingKey, bool nowait, IDictionary arguments) @@ -166,11 +149,7 @@ public override void _Private_ExchangeBind(string destination, string source, st } else { - MethodBase __repBase = ModelRpc(method); - if (!(__repBase is ExchangeBindOk)) - { - throw new UnexpectedMethodException(__repBase); - } + ModelRpc(method); } } @@ -183,11 +162,7 @@ public override void _Private_ExchangeDeclare(string exchange, string type, bool } else { - MethodBase __repBase = ModelRpc(method); - if (!(__repBase is ExchangeDeclareOk)) - { - throw new UnexpectedMethodException(__repBase); - } + ModelRpc(method); } } @@ -200,11 +175,7 @@ public override void _Private_ExchangeDelete(string exchange, bool ifUnused, boo } else { - MethodBase __repBase = ModelRpc(method); - if (!(__repBase is ExchangeDeleteOk)) - { - throw new UnexpectedMethodException(__repBase); - } + ModelRpc(method); } } @@ -217,11 +188,7 @@ public override void _Private_ExchangeUnbind(string destination, string source, } else { - MethodBase __repBase = ModelRpc(method); - if (!(__repBase is ExchangeUnbindOk)) - { - throw new UnexpectedMethodException(__repBase); - } + ModelRpc(method); } } @@ -234,11 +201,7 @@ public override void _Private_QueueBind(string queue, string exchange, string ro } else { - MethodBase __repBase = ModelRpc(method); - if (!(__repBase is QueueBindOk)) - { - throw new UnexpectedMethodException(__repBase); - } + ModelRpc(method); } } @@ -264,12 +227,7 @@ public override uint _Private_QueueDelete(string queue, bool ifUnused, bool ifEm return 0xFFFFFFFF; } - MethodBase __repBase = ModelRpc(method); - if (!(__repBase is QueueDeleteOk __rep)) - { - throw new UnexpectedMethodException(__repBase); - } - return __rep._messageCount; + return ModelRpc(method)._messageCount; } public override uint _Private_QueuePurge(string queue, bool nowait) @@ -281,12 +239,7 @@ public override uint _Private_QueuePurge(string queue, bool nowait) return 0xFFFFFFFF; } - MethodBase __repBase = ModelRpc(method); - if (!(__repBase is QueuePurgeOk __rep)) - { - throw new UnexpectedMethodException(__repBase); - } - return __rep._messageCount; + return ModelRpc(method)._messageCount; } public override void BasicAck(ulong deliveryTag, bool multiple) @@ -301,11 +254,7 @@ public override void BasicNack(ulong deliveryTag, bool multiple, bool requeue) public override void BasicQos(uint prefetchSize, ushort prefetchCount, bool global) { - MethodBase __repBase = ModelRpc(new BasicQos(prefetchSize, prefetchCount, global)); - if (!(__repBase is BasicQosOk)) - { - throw new UnexpectedMethodException(__repBase); - } + ModelRpc(new BasicQos(prefetchSize, prefetchCount, global)); } public override void BasicRecoverAsync(bool requeue) @@ -325,38 +274,22 @@ public override IBasicProperties CreateBasicProperties() public override void QueueUnbind(string queue, string exchange, string routingKey, IDictionary arguments) { - MethodBase __repBase = ModelRpc(new QueueUnbind(default, queue, exchange, routingKey, arguments)); - if (!(__repBase is QueueUnbindOk)) - { - throw new UnexpectedMethodException(__repBase); - } + ModelRpc(new QueueUnbind(default, queue, exchange, routingKey, arguments)); } public override void TxCommit() { - MethodBase __repBase = ModelRpc(new TxCommit()); - if (!(__repBase is TxCommitOk)) - { - throw new UnexpectedMethodException(__repBase); - } + ModelRpc(new TxCommit()); } public override void TxRollback() { - MethodBase __repBase = ModelRpc(new TxRollback()); - if (!(__repBase is TxRollbackOk)) - { - throw new UnexpectedMethodException(__repBase); - } + ModelRpc(new TxRollback()); } public override void TxSelect() { - MethodBase __repBase = ModelRpc(new TxSelect()); - if (!(__repBase is TxSelectOk)) - { - throw new UnexpectedMethodException(__repBase); - } + ModelRpc(new TxSelect()); } public override bool DispatchAsynchronous(in IncomingCommand cmd) diff --git a/projects/RabbitMQ.Client/client/impl/ModelBase.cs b/projects/RabbitMQ.Client/client/impl/ModelBase.cs index d67da0467b..54ce9a66f7 100644 --- a/projects/RabbitMQ.Client/client/impl/ModelBase.cs +++ b/projects/RabbitMQ.Client/client/impl/ModelBase.cs @@ -330,14 +330,23 @@ public void HandleCommand(in IncomingCommand cmd) } } - public MethodBase ModelRpc(MethodBase method) + public T ModelRpc(MethodBase method) where T : MethodBase { var k = new SimpleBlockingRpcContinuation(); + var outgoingCommand = new OutgoingCommand(method); + MethodBase baseResult; lock (_rpcLock) { - TransmitAndEnqueue(new OutgoingCommand(method), k); - return k.GetReply(ContinuationTimeout).Method; + TransmitAndEnqueue(outgoingCommand, k); + baseResult = k.GetReply(ContinuationTimeout).Method; } + + if (baseResult is T result) + { + return result; + } + + throw new UnexpectedMethodException(baseResult); } public void ModelSend(MethodBase method) From ab36f9b64217543bd562316171a27131e75c369a Mon Sep 17 00:00:00 2001 From: bollhals Date: Sat, 15 Aug 2020 01:29:34 +0200 Subject: [PATCH 4/4] more style cleanup taken over from other pull request --- .../RabbitMQ.Client/client/api/AmqpTcpEndpoint.cs | 2 +- .../client/api/ExternalMechanism.cs | 4 +++- .../client/api/IEndpointResolverExtensions.cs | 8 ++++---- .../client/events/AsyncEventHandler.cs | 4 ++-- .../RabbitMQ.Client/client/impl/AmqpVersion.cs | 2 +- .../client/impl/AsyncConsumerWorkService.cs | 6 +++--- .../client/impl/AutorecoveringModel.cs | 4 ++-- .../RabbitMQ.Client/client/impl/BasicProperties.cs | 2 +- projects/RabbitMQ.Client/client/impl/Connection.cs | 2 +- .../client/impl/ConnectionStartDetails.cs | 2 +- .../client/impl/ConsumerWorkService.cs | 10 +++++----- .../client/impl/IConsumerDispatcher.cs | 2 +- .../RabbitMQ.Client/client/impl/IFrameHandler.cs | 2 +- .../client/impl/IProtocolExtensions.cs | 2 +- .../client/impl/IRpcContinuation.cs | 2 +- projects/RabbitMQ.Client/client/impl/MethodBase.cs | 2 +- projects/RabbitMQ.Client/client/impl/ModelBase.cs | 2 +- .../client/impl/RpcContinuationQueue.cs | 7 ++++--- .../RabbitMQ.Client/client/impl/SessionManager.cs | 2 +- .../client/impl/ShutdownContinuation.cs | 2 +- .../client/impl/SimpleBlockingRpcContinuation.cs | 2 +- .../client/impl/SocketFrameHandler.cs | 2 +- projects/RabbitMQ.Client/client/impl/SslHelper.cs | 2 +- .../client/impl/StreamProperties.cs | 2 +- .../client/impl/TcpClientAdapter.cs | 14 +++++++------- .../client/impl/TcpClientAdapterHelper.cs | 2 +- projects/RabbitMQ.Client/client/logging/ESLog.cs | 2 +- projects/RabbitMQ.Client/util/BlockingCell.cs | 2 +- projects/RabbitMQ.Client/util/DebugUtil.cs | 2 +- projects/RabbitMQ.Client/util/Either.cs | 4 ++-- projects/RabbitMQ.Client/util/IntAllocator.cs | 4 +--- projects/RabbitMQ.Client/util/SetQueue.cs | 4 ++-- projects/RabbitMQ.Client/util/SharedQueue.cs | 6 +++--- 33 files changed, 59 insertions(+), 58 deletions(-) diff --git a/projects/RabbitMQ.Client/client/api/AmqpTcpEndpoint.cs b/projects/RabbitMQ.Client/client/api/AmqpTcpEndpoint.cs index 386ee3ba79..81780480ca 100644 --- a/projects/RabbitMQ.Client/client/api/AmqpTcpEndpoint.cs +++ b/projects/RabbitMQ.Client/client/api/AmqpTcpEndpoint.cs @@ -222,7 +222,7 @@ public static AmqpTcpEndpoint Parse(string address) /// public static AmqpTcpEndpoint[] ParseMultiple(string addresses) { - string[] partsArr = addresses.Split(new[] {','}); + string[] partsArr = addresses.Split(','); var results = new List(); foreach (string partRaw in partsArr) { diff --git a/projects/RabbitMQ.Client/client/api/ExternalMechanism.cs b/projects/RabbitMQ.Client/client/api/ExternalMechanism.cs index 361c072a89..f51214ebcc 100644 --- a/projects/RabbitMQ.Client/client/api/ExternalMechanism.cs +++ b/projects/RabbitMQ.Client/client/api/ExternalMechanism.cs @@ -29,6 +29,8 @@ // Copyright (c) 2007-2020 VMware, Inc. All rights reserved. //--------------------------------------------------------------------------- +using System; + namespace RabbitMQ.Client { public class ExternalMechanism : IAuthMechanism @@ -38,7 +40,7 @@ public class ExternalMechanism : IAuthMechanism /// public byte[] handleChallenge(byte[] challenge, IConnectionFactory factory) { - return new byte[0]; + return Array.Empty(); } } } diff --git a/projects/RabbitMQ.Client/client/api/IEndpointResolverExtensions.cs b/projects/RabbitMQ.Client/client/api/IEndpointResolverExtensions.cs index b8d9746c19..dfda1c75d2 100644 --- a/projects/RabbitMQ.Client/client/api/IEndpointResolverExtensions.cs +++ b/projects/RabbitMQ.Client/client/api/IEndpointResolverExtensions.cs @@ -40,12 +40,12 @@ public static T SelectOne(this IEndpointResolver resolver, Func(); - foreach(AmqpTcpEndpoint ep in resolver.All()) + foreach (AmqpTcpEndpoint ep in resolver.All()) { try { t = selector(ep); - if(t.Equals(default(T)) == false) + if (t.Equals(default(T)) == false) { return t; } @@ -56,7 +56,7 @@ public static T SelectOne(this IEndpointResolver resolver, Func 0) + if (Object.Equals(t, default(T)) && exceptions.Count > 0) { throw new AggregateException(exceptions); } @@ -64,4 +64,4 @@ public static T SelectOne(this IEndpointResolver resolver, Func(this AsyncEventHandler eventHandler, object sender, TEvent @event) where TEvent : EventArgs { - if(eventHandler != null) + if (eventHandler != null) { - foreach(AsyncEventHandler handlerInstance in eventHandler.GetInvocationList()) + foreach (AsyncEventHandler handlerInstance in eventHandler.GetInvocationList()) { await handlerInstance(sender, @event).ConfigureAwait(false); } diff --git a/projects/RabbitMQ.Client/client/impl/AmqpVersion.cs b/projects/RabbitMQ.Client/client/impl/AmqpVersion.cs index e78cd5b35f..dfa5a26eab 100644 --- a/projects/RabbitMQ.Client/client/impl/AmqpVersion.cs +++ b/projects/RabbitMQ.Client/client/impl/AmqpVersion.cs @@ -45,7 +45,7 @@ namespace RabbitMQ.Client.Framing.Impl /// special-cases 8-0, rewriting it at construction time to be 0-8 instead. /// /// - class AmqpVersion + internal class AmqpVersion { /// /// Construct an from major and minor version numbers. diff --git a/projects/RabbitMQ.Client/client/impl/AsyncConsumerWorkService.cs b/projects/RabbitMQ.Client/client/impl/AsyncConsumerWorkService.cs index 0a6b0a68d6..5b313577fd 100644 --- a/projects/RabbitMQ.Client/client/impl/AsyncConsumerWorkService.cs +++ b/projects/RabbitMQ.Client/client/impl/AsyncConsumerWorkService.cs @@ -46,10 +46,10 @@ public Task Stop(IModel model) return Task.CompletedTask; } - class WorkPool + private class WorkPool { - readonly Channel _channel; - readonly IModel _model; + private readonly Channel _channel; + private readonly IModel _model; private Task _worker; private readonly int _concurrency; private SemaphoreSlim _limiter; diff --git a/projects/RabbitMQ.Client/client/impl/AutorecoveringModel.cs b/projects/RabbitMQ.Client/client/impl/AutorecoveringModel.cs index f296c54c98..a9163f389b 100644 --- a/projects/RabbitMQ.Client/client/impl/AutorecoveringModel.cs +++ b/projects/RabbitMQ.Client/client/impl/AutorecoveringModel.cs @@ -1828,7 +1828,7 @@ public IBasicPublishBatch CreateBasicPublishBatch() throw new ObjectDisposedException(GetType().FullName); } - return ((IFullModel)_delegate).CreateBasicPublishBatch(); + return _delegate.CreateBasicPublishBatch(); } public IBasicPublishBatch CreateBasicPublishBatch(int sizeHint) @@ -1838,7 +1838,7 @@ public IBasicPublishBatch CreateBasicPublishBatch(int sizeHint) throw new ObjectDisposedException(GetType().FullName); } - return ((IFullModel)_delegate).CreateBasicPublishBatch(sizeHint); + return _delegate.CreateBasicPublishBatch(sizeHint); } } } diff --git a/projects/RabbitMQ.Client/client/impl/BasicProperties.cs b/projects/RabbitMQ.Client/client/impl/BasicProperties.cs index ab0517ea3a..9c17a7a5c1 100644 --- a/projects/RabbitMQ.Client/client/impl/BasicProperties.cs +++ b/projects/RabbitMQ.Client/client/impl/BasicProperties.cs @@ -33,7 +33,7 @@ namespace RabbitMQ.Client.Impl { - abstract class BasicProperties : ContentHeaderBase, IBasicProperties + internal abstract class BasicProperties : ContentHeaderBase, IBasicProperties { /// /// Application Id. diff --git a/projects/RabbitMQ.Client/client/impl/Connection.cs b/projects/RabbitMQ.Client/client/impl/Connection.cs index eee58a246b..0a9fb9b976 100644 --- a/projects/RabbitMQ.Client/client/impl/Connection.cs +++ b/projects/RabbitMQ.Client/client/impl/Connection.cs @@ -1043,7 +1043,7 @@ internal OutgoingCommand ChannelCloseWrapper(ushort reasonCode, string reasonTex return request; } - void StartAndTune() + private void StartAndTune() { var connectionStartCell = new BlockingCell(); _model0.m_connectionStartCell = connectionStartCell; diff --git a/projects/RabbitMQ.Client/client/impl/ConnectionStartDetails.cs b/projects/RabbitMQ.Client/client/impl/ConnectionStartDetails.cs index b792dafbe9..bb540c045a 100644 --- a/projects/RabbitMQ.Client/client/impl/ConnectionStartDetails.cs +++ b/projects/RabbitMQ.Client/client/impl/ConnectionStartDetails.cs @@ -33,7 +33,7 @@ namespace RabbitMQ.Client.Impl { - class ConnectionStartDetails + internal class ConnectionStartDetails { public byte[] m_locales; public byte[] m_mechanisms; diff --git a/projects/RabbitMQ.Client/client/impl/ConsumerWorkService.cs b/projects/RabbitMQ.Client/client/impl/ConsumerWorkService.cs index a219a8081d..4813fdaf8e 100644 --- a/projects/RabbitMQ.Client/client/impl/ConsumerWorkService.cs +++ b/projects/RabbitMQ.Client/client/impl/ConsumerWorkService.cs @@ -60,12 +60,12 @@ internal Task StopWorkAsync(IModel model) return Task.CompletedTask; } - class WorkPool + private class WorkPool { private readonly Channel _channel; private readonly int _concurrency; private Task _worker; - CancellationTokenSource _tokenSource; + private CancellationTokenSource _tokenSource; private SemaphoreSlim _limiter; public WorkPool(int concurrency) @@ -93,7 +93,7 @@ public void Enqueue(Action action) _channel.Writer.TryWrite(action); } - async Task Loop() + private async Task Loop() { while (await _channel.Reader.WaitToReadAsync().ConfigureAwait(false)) { @@ -111,7 +111,7 @@ async Task Loop() } } - async Task LoopWithConcurrency(CancellationToken cancellationToken) + private async Task LoopWithConcurrency(CancellationToken cancellationToken) { try { @@ -135,7 +135,7 @@ async Task LoopWithConcurrency(CancellationToken cancellationToken) } } - static async Task OffloadToWorkerThreadPool(Action action, SemaphoreSlim limiter) + private static async Task OffloadToWorkerThreadPool(Action action, SemaphoreSlim limiter) { try { diff --git a/projects/RabbitMQ.Client/client/impl/IConsumerDispatcher.cs b/projects/RabbitMQ.Client/client/impl/IConsumerDispatcher.cs index 0c6b0883e7..cc3c5ab1e7 100644 --- a/projects/RabbitMQ.Client/client/impl/IConsumerDispatcher.cs +++ b/projects/RabbitMQ.Client/client/impl/IConsumerDispatcher.cs @@ -34,7 +34,7 @@ namespace RabbitMQ.Client.Impl { - interface IConsumerDispatcher + internal interface IConsumerDispatcher { bool IsShutdown { get; } diff --git a/projects/RabbitMQ.Client/client/impl/IFrameHandler.cs b/projects/RabbitMQ.Client/client/impl/IFrameHandler.cs index e3ae5f7931..cf0dc14b62 100644 --- a/projects/RabbitMQ.Client/client/impl/IFrameHandler.cs +++ b/projects/RabbitMQ.Client/client/impl/IFrameHandler.cs @@ -34,7 +34,7 @@ namespace RabbitMQ.Client.Impl { - interface IFrameHandler + internal interface IFrameHandler { AmqpTcpEndpoint Endpoint { get; } diff --git a/projects/RabbitMQ.Client/client/impl/IProtocolExtensions.cs b/projects/RabbitMQ.Client/client/impl/IProtocolExtensions.cs index bf6366d17c..fc174c6e02 100644 --- a/projects/RabbitMQ.Client/client/impl/IProtocolExtensions.cs +++ b/projects/RabbitMQ.Client/client/impl/IProtocolExtensions.cs @@ -37,7 +37,7 @@ namespace RabbitMQ.Client.Framing.Impl { - static class IProtocolExtensions + internal static class IProtocolExtensions { public static IFrameHandler CreateFrameHandler( this IProtocol protocol, diff --git a/projects/RabbitMQ.Client/client/impl/IRpcContinuation.cs b/projects/RabbitMQ.Client/client/impl/IRpcContinuation.cs index 0bd7292364..8cc84d66c0 100644 --- a/projects/RabbitMQ.Client/client/impl/IRpcContinuation.cs +++ b/projects/RabbitMQ.Client/client/impl/IRpcContinuation.cs @@ -31,7 +31,7 @@ namespace RabbitMQ.Client.Impl { - interface IRpcContinuation + internal interface IRpcContinuation { void HandleCommand(in IncomingCommand cmd); void HandleModelShutdown(ShutdownEventArgs reason); diff --git a/projects/RabbitMQ.Client/client/impl/MethodBase.cs b/projects/RabbitMQ.Client/client/impl/MethodBase.cs index 716b54f1c8..54336dc7ff 100644 --- a/projects/RabbitMQ.Client/client/impl/MethodBase.cs +++ b/projects/RabbitMQ.Client/client/impl/MethodBase.cs @@ -31,7 +31,7 @@ namespace RabbitMQ.Client.Impl { - abstract class MethodBase : IMethod + internal abstract class MethodBase : IMethod { public abstract bool HasContent { get; } diff --git a/projects/RabbitMQ.Client/client/impl/ModelBase.cs b/projects/RabbitMQ.Client/client/impl/ModelBase.cs index 54ce9a66f7..3c6eba8237 100644 --- a/projects/RabbitMQ.Client/client/impl/ModelBase.cs +++ b/projects/RabbitMQ.Client/client/impl/ModelBase.cs @@ -45,7 +45,7 @@ namespace RabbitMQ.Client.Impl { - abstract class ModelBase : IFullModel, IRecoverable + internal abstract class ModelBase : IFullModel, IRecoverable { ///Only used to kick-start a connection open ///sequence. See diff --git a/projects/RabbitMQ.Client/client/impl/RpcContinuationQueue.cs b/projects/RabbitMQ.Client/client/impl/RpcContinuationQueue.cs index 816e6388af..6c8e2ee194 100644 --- a/projects/RabbitMQ.Client/client/impl/RpcContinuationQueue.cs +++ b/projects/RabbitMQ.Client/client/impl/RpcContinuationQueue.cs @@ -43,7 +43,7 @@ namespace RabbitMQ.Client.Impl /// under a somewhat generous reading. /// /// - class RpcContinuationQueue + internal class RpcContinuationQueue { private class EmptyRpcContinuation : IRpcContinuation { @@ -55,8 +55,9 @@ public void HandleModelShutdown(ShutdownEventArgs reason) { } } - static readonly EmptyRpcContinuation s_tmp = new EmptyRpcContinuation(); - IRpcContinuation _outstandingRpc = s_tmp; + + private static readonly EmptyRpcContinuation s_tmp = new EmptyRpcContinuation(); + private IRpcContinuation _outstandingRpc = s_tmp; ///Enqueue a continuation, marking a pending RPC. /// diff --git a/projects/RabbitMQ.Client/client/impl/SessionManager.cs b/projects/RabbitMQ.Client/client/impl/SessionManager.cs index 05ded4d5ef..23e2ee1e1d 100644 --- a/projects/RabbitMQ.Client/client/impl/SessionManager.cs +++ b/projects/RabbitMQ.Client/client/impl/SessionManager.cs @@ -36,7 +36,7 @@ namespace RabbitMQ.Client.Impl { - class SessionManager + internal class SessionManager { public readonly ushort ChannelMax; private readonly IntAllocator _ints; diff --git a/projects/RabbitMQ.Client/client/impl/ShutdownContinuation.cs b/projects/RabbitMQ.Client/client/impl/ShutdownContinuation.cs index bf0ce9395f..ee77c878f1 100644 --- a/projects/RabbitMQ.Client/client/impl/ShutdownContinuation.cs +++ b/projects/RabbitMQ.Client/client/impl/ShutdownContinuation.cs @@ -35,7 +35,7 @@ namespace RabbitMQ.Client.Impl { - class ShutdownContinuation + internal class ShutdownContinuation { public readonly BlockingCell m_cell = new BlockingCell(); diff --git a/projects/RabbitMQ.Client/client/impl/SimpleBlockingRpcContinuation.cs b/projects/RabbitMQ.Client/client/impl/SimpleBlockingRpcContinuation.cs index 19dccb40a5..5c45a8948b 100644 --- a/projects/RabbitMQ.Client/client/impl/SimpleBlockingRpcContinuation.cs +++ b/projects/RabbitMQ.Client/client/impl/SimpleBlockingRpcContinuation.cs @@ -35,7 +35,7 @@ namespace RabbitMQ.Client.Impl { - class SimpleBlockingRpcContinuation : IRpcContinuation + internal class SimpleBlockingRpcContinuation : IRpcContinuation { public readonly BlockingCell> m_cell = new BlockingCell>(); diff --git a/projects/RabbitMQ.Client/client/impl/SocketFrameHandler.cs b/projects/RabbitMQ.Client/client/impl/SocketFrameHandler.cs index 09151ceb4c..71f1ce070c 100644 --- a/projects/RabbitMQ.Client/client/impl/SocketFrameHandler.cs +++ b/projects/RabbitMQ.Client/client/impl/SocketFrameHandler.cs @@ -60,7 +60,7 @@ public static async Task TimeoutAfter(this Task task, TimeSpan timeout) } } - class SocketFrameHandler : IFrameHandler + internal class SocketFrameHandler : IFrameHandler { // Socket poll timeout in ms. If the socket does not // become writeable in this amount of time, we throw diff --git a/projects/RabbitMQ.Client/client/impl/SslHelper.cs b/projects/RabbitMQ.Client/client/impl/SslHelper.cs index ee1f0ae31d..7e8abb87fa 100644 --- a/projects/RabbitMQ.Client/client/impl/SslHelper.cs +++ b/projects/RabbitMQ.Client/client/impl/SslHelper.cs @@ -41,7 +41,7 @@ namespace RabbitMQ.Client.Impl /// Represents an which does the actual heavy lifting to set up an SSL connection, /// using the config options in an to make things cleaner. /// - class SslHelper + internal class SslHelper { private readonly SslOption _sslOption; diff --git a/projects/RabbitMQ.Client/client/impl/StreamProperties.cs b/projects/RabbitMQ.Client/client/impl/StreamProperties.cs index e37ae2d5b4..0109e00d99 100644 --- a/projects/RabbitMQ.Client/client/impl/StreamProperties.cs +++ b/projects/RabbitMQ.Client/client/impl/StreamProperties.cs @@ -33,7 +33,7 @@ namespace RabbitMQ.Client.Impl { - abstract class StreamProperties : ContentHeaderBase, IStreamProperties + internal abstract class StreamProperties : ContentHeaderBase, IStreamProperties { public abstract string ContentEncoding { get; set; } public abstract string ContentType { get; set; } diff --git a/projects/RabbitMQ.Client/client/impl/TcpClientAdapter.cs b/projects/RabbitMQ.Client/client/impl/TcpClientAdapter.cs index e0f99fd2f1..2db1e1d53c 100644 --- a/projects/RabbitMQ.Client/client/impl/TcpClientAdapter.cs +++ b/projects/RabbitMQ.Client/client/impl/TcpClientAdapter.cs @@ -8,7 +8,7 @@ namespace RabbitMQ.Client.Impl /// /// Simple wrapper around TcpClient. /// - class TcpClientAdapter : ITcpClient + internal class TcpClientAdapter : ITcpClient { private Socket _sock; @@ -42,10 +42,7 @@ public virtual async Task ConnectAsync(IPAddress ep, int port) public virtual void Close() { - if (_sock != null) - { - _sock.Dispose(); - } + _sock?.Dispose(); _sock = null; } @@ -84,7 +81,10 @@ public virtual bool Connected { get { - if(_sock == null) return false; + if (_sock is null) + { + return false; + } return _sock.Connected; } } @@ -105,7 +105,7 @@ public virtual TimeSpan ReceiveTimeout private void AssertSocket() { - if(_sock == null) + if (_sock is null) { throw new InvalidOperationException("Cannot perform operation as socket is null"); } diff --git a/projects/RabbitMQ.Client/client/impl/TcpClientAdapterHelper.cs b/projects/RabbitMQ.Client/client/impl/TcpClientAdapterHelper.cs index 4fc8b46697..4bb9ce0dfa 100644 --- a/projects/RabbitMQ.Client/client/impl/TcpClientAdapterHelper.cs +++ b/projects/RabbitMQ.Client/client/impl/TcpClientAdapterHelper.cs @@ -5,7 +5,7 @@ namespace RabbitMQ.Client.Impl { - static class TcpClientAdapterHelper + internal static class TcpClientAdapterHelper { public static IPAddress GetMatchingHost(IReadOnlyCollection addresses, AddressFamily addressFamily) { diff --git a/projects/RabbitMQ.Client/client/logging/ESLog.cs b/projects/RabbitMQ.Client/client/logging/ESLog.cs index 1e38ac0f07..dca4c15f4a 100644 --- a/projects/RabbitMQ.Client/client/logging/ESLog.cs +++ b/projects/RabbitMQ.Client/client/logging/ESLog.cs @@ -31,7 +31,7 @@ namespace RabbitMQ.Client.Logging { - static class ESLog + internal static class ESLog { public static void Info(string message) { diff --git a/projects/RabbitMQ.Client/util/BlockingCell.cs b/projects/RabbitMQ.Client/util/BlockingCell.cs index 78fa520aff..8f7c0d2736 100644 --- a/projects/RabbitMQ.Client/util/BlockingCell.cs +++ b/projects/RabbitMQ.Client/util/BlockingCell.cs @@ -44,7 +44,7 @@ namespace RabbitMQ.Util ///attempts to set Value result in a thrown ///InvalidOperationException. /// - class BlockingCell + internal class BlockingCell { private readonly ManualResetEventSlim _manualResetEventSlim = new ManualResetEventSlim(false); private T _value = default; diff --git a/projects/RabbitMQ.Client/util/DebugUtil.cs b/projects/RabbitMQ.Client/util/DebugUtil.cs index 3a6d50f57e..cb73a78111 100644 --- a/projects/RabbitMQ.Client/util/DebugUtil.cs +++ b/projects/RabbitMQ.Client/util/DebugUtil.cs @@ -40,7 +40,7 @@ namespace RabbitMQ.Util /// ///Not part of the public API. /// - static class DebugUtil + internal static class DebugUtil { ///Print a hex dump of the supplied bytes to stdout. public static void Dump(byte[] bytes) diff --git a/projects/RabbitMQ.Client/util/Either.cs b/projects/RabbitMQ.Client/util/Either.cs index b21efa6ce1..0fa8a33a89 100644 --- a/projects/RabbitMQ.Client/util/Either.cs +++ b/projects/RabbitMQ.Client/util/Either.cs @@ -32,7 +32,7 @@ namespace RabbitMQ.Util { ///Used internally by class Either. - enum EitherAlternative + internal enum EitherAlternative { Left, Right @@ -42,7 +42,7 @@ enum EitherAlternative ///Models the disjoint union of two alternatives, a ///"left" alternative and a "right" alternative. ///Borrowed from ML, Haskell etc. - class Either + internal class Either { ///Private constructor. Use the static methods Left, Right instead. private Either(EitherAlternative alternative, L valueL, R valueR) diff --git a/projects/RabbitMQ.Client/util/IntAllocator.cs b/projects/RabbitMQ.Client/util/IntAllocator.cs index 34d1947dd9..39dd8d58f6 100644 --- a/projects/RabbitMQ.Client/util/IntAllocator.cs +++ b/projects/RabbitMQ.Client/util/IntAllocator.cs @@ -37,9 +37,7 @@ namespace RabbitMQ.Util /** * A class for allocating integer IDs in a given range. */ - - - class IntAllocator + internal class IntAllocator { private readonly int[] _unsorted; private IntervalList _base; diff --git a/projects/RabbitMQ.Client/util/SetQueue.cs b/projects/RabbitMQ.Client/util/SetQueue.cs index 9ea7fc42e6..1da9e1713b 100644 --- a/projects/RabbitMQ.Client/util/SetQueue.cs +++ b/projects/RabbitMQ.Client/util/SetQueue.cs @@ -33,14 +33,14 @@ namespace RabbitMQ.Util { - class SetQueue + internal class SetQueue { private readonly HashSet _members = new HashSet(); private readonly LinkedList _queue = new LinkedList(); public bool Enqueue(T item) { - if(_members.Contains(item)) + if (_members.Contains(item)) { return false; } diff --git a/projects/RabbitMQ.Client/util/SharedQueue.cs b/projects/RabbitMQ.Client/util/SharedQueue.cs index 34b6d37b0c..36e53b8b4d 100644 --- a/projects/RabbitMQ.Client/util/SharedQueue.cs +++ b/projects/RabbitMQ.Client/util/SharedQueue.cs @@ -38,13 +38,13 @@ namespace RabbitMQ.Util { ///A thread-safe shared queue implementation. - class SharedQueue : SharedQueue + internal class SharedQueue : SharedQueue { } ///A thread-safe shared queue implementation. - class SharedQueue : IEnumerable + internal class SharedQueue : IEnumerable { ///Flag holding our current status. protected bool m_isOpen = true; @@ -240,7 +240,7 @@ private void EnsureIsOpen() ///Implementation of the IEnumerator interface, for ///permitting SharedQueue to be used in foreach loops. - struct SharedQueueEnumerator : IEnumerator + internal struct SharedQueueEnumerator : IEnumerator { private readonly SharedQueue _queue; private T _current;