├── dotnet └── _._ ├── nanoFramework ├── Amqp.nanoFramework │ ├── Handler │ │ └── .gitkeep │ └── packages.config ├── Test.Amqp.nanoFramework │ ├── Test │ │ └── .gitkeep │ ├── packages.config │ └── Properties │ │ └── AssemblyInfo.cs └── Amqp.Micro.nanoFramework │ └── packages.config ├── src ├── amqp.snk ├── Net │ ├── TcpKeepAliveSettings.cs │ ├── Map.Net.cs │ ├── List.cs │ ├── WrappedByteBuffer.cs │ ├── IConnectionFactory.cs │ ├── IBufferManager.cs │ └── TransportProvider.cs ├── Properties │ ├── StoreAssemblyInfo.cs │ ├── Version.cs │ └── AssemblyInfo.cs ├── Directory.Build.props ├── Amqp.WebSockets.Client.csproj ├── Serialization │ ├── OnSerializedAttribute.cs │ ├── OnDeserializedAttribute.cs │ ├── OnSerializingAttribute.cs │ ├── OnDeserializingAttribute.cs │ ├── SerializableMember.cs │ ├── IContractResolver.cs │ ├── AmqpMember.cs │ ├── EncodingType.cs │ ├── IAmqpSerializable.cs │ ├── AmqpProvidesAttribute.cs │ └── AmqpMemberAttribute.cs ├── Listener │ ├── IAuthenticated.cs │ ├── ContextState.cs │ ├── IRequestProcessor.cs │ ├── IMessageProcessor.cs │ ├── ILinkProcessor.cs │ ├── DispositionContext.cs │ ├── ListenerSession.cs │ ├── LinkCollection.cs │ ├── ReceiveContext.cs │ ├── FlowContext.cs │ └── MessageContext.cs ├── Amqp.Net.csproj ├── Types │ ├── IStringDecoder.cs │ └── Descriptor.cs ├── CreditMode.cs ├── Framing │ ├── ReceiverSettleMode.cs │ ├── Outcome.cs │ ├── SenderSettleMode.cs │ ├── Footer.cs │ ├── DeliveryState.cs │ ├── ApplicationProperties.cs │ ├── DeliveryAnnotations.cs │ ├── MessageAnnotations.cs │ ├── AmqpSequence.cs │ ├── Released.cs │ └── Accepted.cs ├── Handler │ ├── IHandler.cs │ └── IDelivery.cs ├── Amqp.Serialization.csproj ├── WinRT │ └── Timer.cs ├── Sasl │ └── SaslCode.cs └── ITransport.cs ├── docs ├── toc.yml ├── template │ └── index.html.tmpl ├── docfx.json ├── articles │ ├── toc.yml │ ├── versioning.md │ ├── tracing.md │ ├── test_amqp_broker.md │ └── installation.md └── index.md ├── Examples ├── Device │ ├── Device.Thermometer │ │ ├── OnBoardFlash.dat │ │ ├── OnBoardFlash.dat.smd │ │ ├── Resources │ │ │ └── small.tinyfnt │ │ ├── Resources.Designer.cs │ │ └── Properties │ │ │ └── AssemblyInfo.cs │ ├── Device.Controller │ │ ├── Assets │ │ │ ├── AlignmentGrid.png │ │ │ ├── ApplicationIcon.png │ │ │ └── Tiles │ │ │ │ ├── IconicTileSmall.png │ │ │ │ ├── FlipCycleTileLarge.png │ │ │ │ ├── FlipCycleTileMedium.png │ │ │ │ ├── FlipCycleTileSmall.png │ │ │ │ └── IconicTileMediumLarge.png │ │ ├── Properties │ │ │ ├── AppManifest.xml │ │ │ ├── WMAppManifest.xml │ │ │ └── AssemblyInfo.cs │ │ ├── App.xaml │ │ └── LocalizedStrings.cs │ ├── Device.SmallMemory.nanoFramework │ │ ├── packages.config │ │ └── Properties │ │ │ └── AssemblyInfo.cs │ ├── Device.Thermometer.nanoFramework │ │ ├── packages.config │ │ └── Properties │ │ │ └── AssemblyInfo.cs │ └── Device.SmallMemory │ │ └── Properties │ │ └── AssemblyInfo.cs ├── Interop │ ├── Interop.Drain │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── App.config │ ├── Interop.Spout │ │ └── App.config │ ├── Interop.Client │ │ └── App.config │ └── Interop.Server │ │ └── App.config ├── PeerToPeer │ ├── PeerToPeer.Client │ │ ├── App.config │ │ └── Properties │ │ │ └── AssemblyInfo.cs │ ├── PeerToPeer.Server │ │ └── App.config │ ├── PeerToPeer.CustomType │ │ ├── App.config │ │ └── Properties │ │ │ └── AssemblyInfo.cs │ ├── PeerToPeer.Receiver │ │ └── App.config │ └── PeerToPeer.CustomTransport │ │ └── Properties │ │ └── AssemblyInfo.cs ├── Reconnect │ └── ReconnectSender │ │ ├── App.config │ │ └── Properties │ │ └── AssemblyInfo.cs ├── ServiceBus │ ├── ServiceBus.Cbs │ │ ├── App.config │ │ └── Program.cs │ ├── ServiceBus.Listener │ │ ├── ServiceBus.Listener.csproj │ │ └── Program.cs │ ├── ServiceBus.EventHub.nanoFramework │ │ ├── packages.config │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── Program.cs │ ├── ServiceBus.EventHub.NetMF │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── Program.cs │ ├── ServiceBus.Topic │ │ └── Program.cs │ ├── ServiceBus.WebSockets │ │ └── Program.cs │ ├── ServiceBus.EventHub │ │ └── Program.cs │ ├── ServiceBus.MessageSession │ │ └── Program.cs │ └── Scenarios │ │ └── Example.cs └── Serialization │ └── Serialization.Poco │ ├── Properties │ └── AssemblyInfo.cs │ └── Shape.cs ├── test ├── Test.Amqp.NetCore │ ├── Images │ │ ├── UnitTestLogo.scale-100.png │ │ ├── UnitTestSmallLogo.scale-100.png │ │ ├── UnitTestStoreLogo.scale-100.png │ │ └── UnitTestSplashScreen.scale-100.png │ ├── Test.Amqp.NetCore_TemporaryKey.pfx │ ├── Properties │ │ └── AssemblyInfo.cs │ └── Package.appxmanifest ├── TestAmqpBroker │ ├── App.config │ └── TestAmqpBroker.csproj ├── Test.Amqp.NetFX40 │ ├── packages.config │ ├── app.config │ └── Properties │ │ └── AssemblyInfo.cs ├── Common │ ├── Types │ │ ├── StreetAddress.cs │ │ ├── Teacher.cs │ │ ├── Specification.cs │ │ └── Student.cs │ ├── TestHandler.cs │ ├── ArgumentAttribute.cs │ ├── MessageBatch.cs │ └── TestSetup.cs ├── Test.Amqp.Net │ └── Test.Amqp.Net.csproj ├── Test.Amqp.NetCoreApp │ └── Test.Amqp.NetCoreApp.csproj ├── PerfTest │ └── Properties │ │ └── AssemblyInfo.cs └── LongHaulTest │ └── Properties │ └── AssemblyInfo.cs ├── .gitattributes ├── csproj ├── packages.Amqp.NetFX40.config └── Amqp.Uwp.project.json ├── netmf ├── NetMF │ ├── Map.cs │ ├── TimeoutException.cs │ └── List.cs ├── NetMFLite │ └── Link.cs └── Test │ └── Program.cs ├── .gitignore └── nuspec ├── AMQPNetMicro.nanoFramework.nuspec ├── AMQPNetLite.nanoFramework.nuspec ├── AMQPNetMicro.nuspec ├── AMQPNetLite.Serialization.nuspec ├── AMQPNetLite.WebSockets.nuspec └── AMQPNetLite.NetMF.nuspec /dotnet/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nanoFramework/Amqp.nanoFramework/Handler/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nanoFramework/Test.Amqp.nanoFramework/Test/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/amqp.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/amqpnetlite/HEAD/src/amqp.snk -------------------------------------------------------------------------------- /docs/toc.yml: -------------------------------------------------------------------------------- 1 | 2 | - name: Articles 3 | href: articles/ 4 | - name: Api Documentation 5 | href: api/ 6 | -------------------------------------------------------------------------------- /Examples/Device/Device.Thermometer/OnBoardFlash.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/amqpnetlite/HEAD/Examples/Device/Device.Thermometer/OnBoardFlash.dat -------------------------------------------------------------------------------- /Examples/Device/Device.Thermometer/OnBoardFlash.dat.smd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/amqpnetlite/HEAD/Examples/Device/Device.Thermometer/OnBoardFlash.dat.smd -------------------------------------------------------------------------------- /Examples/Interop/Interop.Drain/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/amqpnetlite/HEAD/Examples/Interop/Interop.Drain/Properties/AssemblyInfo.cs -------------------------------------------------------------------------------- /test/Test.Amqp.NetCore/Images/UnitTestLogo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/amqpnetlite/HEAD/test/Test.Amqp.NetCore/Images/UnitTestLogo.scale-100.png -------------------------------------------------------------------------------- /test/Test.Amqp.NetCore/Test.Amqp.NetCore_TemporaryKey.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/amqpnetlite/HEAD/test/Test.Amqp.NetCore/Test.Amqp.NetCore_TemporaryKey.pfx -------------------------------------------------------------------------------- /Examples/Device/Device.Controller/Assets/AlignmentGrid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/amqpnetlite/HEAD/Examples/Device/Device.Controller/Assets/AlignmentGrid.png -------------------------------------------------------------------------------- /Examples/Device/Device.Controller/Assets/ApplicationIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/amqpnetlite/HEAD/Examples/Device/Device.Controller/Assets/ApplicationIcon.png -------------------------------------------------------------------------------- /Examples/Device/Device.Thermometer/Resources/small.tinyfnt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/amqpnetlite/HEAD/Examples/Device/Device.Thermometer/Resources/small.tinyfnt -------------------------------------------------------------------------------- /test/Test.Amqp.NetCore/Images/UnitTestSmallLogo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/amqpnetlite/HEAD/test/Test.Amqp.NetCore/Images/UnitTestSmallLogo.scale-100.png -------------------------------------------------------------------------------- /test/Test.Amqp.NetCore/Images/UnitTestStoreLogo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/amqpnetlite/HEAD/test/Test.Amqp.NetCore/Images/UnitTestStoreLogo.scale-100.png -------------------------------------------------------------------------------- /test/Test.Amqp.NetCore/Images/UnitTestSplashScreen.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/amqpnetlite/HEAD/test/Test.Amqp.NetCore/Images/UnitTestSplashScreen.scale-100.png -------------------------------------------------------------------------------- /Examples/Device/Device.Controller/Assets/Tiles/IconicTileSmall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/amqpnetlite/HEAD/Examples/Device/Device.Controller/Assets/Tiles/IconicTileSmall.png -------------------------------------------------------------------------------- /Examples/Device/Device.Controller/Assets/Tiles/FlipCycleTileLarge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/amqpnetlite/HEAD/Examples/Device/Device.Controller/Assets/Tiles/FlipCycleTileLarge.png -------------------------------------------------------------------------------- /Examples/Device/Device.Controller/Assets/Tiles/FlipCycleTileMedium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/amqpnetlite/HEAD/Examples/Device/Device.Controller/Assets/Tiles/FlipCycleTileMedium.png -------------------------------------------------------------------------------- /Examples/Device/Device.Controller/Assets/Tiles/FlipCycleTileSmall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/amqpnetlite/HEAD/Examples/Device/Device.Controller/Assets/Tiles/FlipCycleTileSmall.png -------------------------------------------------------------------------------- /Examples/Device/Device.Controller/Assets/Tiles/IconicTileMediumLarge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/amqpnetlite/HEAD/Examples/Device/Device.Controller/Assets/Tiles/IconicTileMediumLarge.png -------------------------------------------------------------------------------- /test/TestAmqpBroker/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Examples/Interop/Interop.Drain/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Examples/Interop/Interop.Spout/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Examples/PeerToPeer/PeerToPeer.Client/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Examples/PeerToPeer/PeerToPeer.Server/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Examples/Reconnect/ReconnectSender/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Examples/ServiceBus/ServiceBus.Cbs/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Examples/PeerToPeer/PeerToPeer.CustomType/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Examples/PeerToPeer/PeerToPeer.Receiver/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Examples/Device/Device.Controller/Properties/AppManifest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set the default behavior, in case people don't have core.autocrlf set. 2 | * text=auto 3 | 4 | # Denote all files that are truly binary and should not be modified. 5 | *.exe binary 6 | *.dll binary 7 | *.pdb binary 8 | *.ico binary 9 | *.png binary 10 | *.jpg binary 11 | -------------------------------------------------------------------------------- /csproj/packages.Amqp.NetFX40.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/Test.Amqp.NetFX40/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/template/index.html.tmpl: -------------------------------------------------------------------------------- 1 | {{!include(/^styles/.*/)}} 2 | {{!include(/^fonts/.*/)}} 3 | {{!include(favicon.ico)}} 4 | {{!include(logo.svg)}} 5 | 6 | 7 | 8 | {{>partials/head}} 9 | 10 | {{{conceptual}}} 11 | {{>partials/scripts}} 12 | 13 | -------------------------------------------------------------------------------- /csproj/Amqp.Uwp.project.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "Microsoft.NETCore.UniversalWindowsPlatform": "5.1.0" 4 | }, 5 | "frameworks": { 6 | "uap10.0": {} 7 | }, 8 | "runtimes": { 9 | "win10-arm": {}, 10 | "win10-arm-aot": {}, 11 | "win10-x86": {}, 12 | "win10-x86-aot": {}, 13 | "win10-x64": {}, 14 | "win10-x64-aot": {} 15 | } 16 | } -------------------------------------------------------------------------------- /docs/docfx.json: -------------------------------------------------------------------------------- 1 | { 2 | "metadata": [ 3 | { 4 | "src": [ 5 | { 6 | "files": [ "csproj/Amqp.Net.csproj" ], 7 | "exclude": [ "**/obj/**", "**/bin/**" ], 8 | "src": "../" 9 | } 10 | ], 11 | "dest": "api" 12 | } 13 | ], 14 | "build": { 15 | "content": [ 16 | { 17 | "files": [ "api/**/*.yml" ] 18 | }, 19 | { 20 | "files": [ "articles/**.md", "articles/**/toc.yml", "toc.yml", "*.md" ] 21 | } 22 | ], 23 | "dest": "../build/_site", 24 | "template": [ "default", "template" ], 25 | "globalMetadata": { 26 | "_disableContribution": true 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /test/Test.Amqp.NetFX40/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Examples/ServiceBus/ServiceBus.Listener/ServiceBus.Listener.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net472;net5 4 | false 5 | ../../obj/$(Configuration)/$(MSBuildProjectName) 6 | ../../bin/$(Configuration)/$(MSBuildProjectName) 7 | Exe 8 | preview 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/Net/TcpKeepAliveSettings.cs: -------------------------------------------------------------------------------- 1 | namespace Amqp 2 | { 3 | /// 4 | /// TCP Keep-Alive settings. 5 | /// 6 | public class TcpKeepAliveSettings 7 | { 8 | /// 9 | /// Gets or sets a value in milliseconds that defines how often a keep-alive transmission is sent to an idle connection. 10 | /// 11 | public uint KeepAliveTime 12 | { 13 | get; 14 | set; 15 | } 16 | 17 | /// 18 | /// Gets or sets a value in milliseconds that defines how often a keep-alive transmission 19 | /// is sent when no response is received from previous keep-alive transmissions. 20 | /// 21 | public uint KeepAliveInterval 22 | { 23 | get; 24 | set; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /nanoFramework/Amqp.Micro.nanoFramework/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Examples/Device/Device.SmallMemory.nanoFramework/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Examples/ServiceBus/ServiceBus.EventHub.nanoFramework/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /nanoFramework/Amqp.nanoFramework/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /nanoFramework/Test.Amqp.nanoFramework/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Examples/Device/Device.Thermometer.nanoFramework/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/articles/toc.yml: -------------------------------------------------------------------------------- 1 | - name: Getting Started 2 | items: 3 | - name: Hello AMQP! 4 | href: hello_amqp.md 5 | - name: Building Application 6 | href: building_application.md 7 | - name: Working with Code 8 | href: working_with_code.md 9 | - name: Using the Library 10 | items: 11 | - name: NuGet Packages 12 | href: installation.md 13 | - name: Versioning 14 | href: versioning.md 15 | - name: Serialization 16 | href: serialization.md 17 | - name: Listener 18 | href: listener.md 19 | - name: Buffer Management 20 | href: buffer_management.md 21 | - name: Fault Tolerance 22 | href: fault_tolerance.md 23 | - name: Tracing 24 | href: tracing.md 25 | - name: Test Amqp Broker 26 | href: test_amqp_broker.md 27 | - name: Use Cases 28 | items: 29 | - name: Azure Event Hubs 30 | href: azure_eventhubs.md 31 | - name: IoT Hub Device Endpoints 32 | href: device_to_iothub.md 33 | - name: IoT Hub Service Endpoints 34 | href: service_to_iothub.md 35 | -------------------------------------------------------------------------------- /Examples/Interop/Interop.Client/App.config: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Examples/Interop/Interop.Server/App.config: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Examples/Device/Device.SmallMemory/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Device.SmallMemory")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Device.SmallMemory")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Version information for an assembly consists of the following four values: 18 | // 19 | // Major Version 20 | // Minor Version 21 | // Build Number 22 | // Revision 23 | // 24 | [assembly: AssemblyVersion("1.0.0.0")] 25 | [assembly: AssemblyFileVersion("1.0.0.0")] 26 | -------------------------------------------------------------------------------- /Examples/Device/Device.Controller/App.xaml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Examples/ServiceBus/ServiceBus.EventHub.NetMF/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MFConsoleApplication1")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MFConsoleApplication1")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Version information for an assembly consists of the following four values: 18 | // 19 | // Major Version 20 | // Minor Version 21 | // Build Number 22 | // Revision 23 | // 24 | [assembly: AssemblyVersion("1.0.0.0")] 25 | [assembly: AssemblyFileVersion("1.0.0.0")] 26 | -------------------------------------------------------------------------------- /src/Properties/StoreAssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | using System.Resources; 19 | 20 | [assembly: NeutralResourcesLanguage("en-US")] -------------------------------------------------------------------------------- /docs/articles/versioning.md: -------------------------------------------------------------------------------- 1 | The library uses the following versioning scheme for the assemblies and the NuGet packages. 2 | `..` 3 | 4 | ## Assembly Version 5 | 6 | ``` 7 | major - increases when there are breaking changes that require app code updates. 8 | minor - increases when there are breaking changes that require only app code recompilication. 9 | patch - typically do not change. 10 | ``` 11 | 12 | Assemblies in the package are signed with a published key, so they are strongly named. 13 | `major` and `minor` version numbers are increased as shown above. When a new release does not have 14 | any breaking changes, assembly version remains the same. This enables the application to do 15 | an in-place upgrade without recompiling or updating the application code. 16 | 17 | ## Assembly File Version 18 | 19 | Follows the NuGet package version. 20 | 21 | ## NuGet Package Version 22 | 23 | Follows the same rules in Assembly Version to increase `major` and `minor` numbers. If `major` and `minor` are 24 | not increased, `patch` is incremented in each release; otherwise, `patch` is reset to 0. 25 | -------------------------------------------------------------------------------- /test/Test.Amqp.NetCore/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Test.Amqp.NetCore")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Test.Amqp.NetCore")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Version information for an assembly consists of the following four values: 18 | // 19 | // Major Version 20 | // Minor Version 21 | // Build Number 22 | // Revision 23 | // 24 | // You can specify all the values or you can default the Build and Revision Numbers 25 | // by using the '*' as shown below: 26 | // [assembly: AssemblyVersion("1.0.*")] 27 | [assembly: AssemblyVersion("1.0.0.0")] 28 | [assembly: AssemblyFileVersion("1.0.0.0")] 29 | -------------------------------------------------------------------------------- /src/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | true 4 | amqp.snk 5 | true 6 | true 7 | ..\obj\$(MSBuildProjectName)\ 8 | true 9 | false 10 | false 11 | false 12 | false 13 | false 14 | false 15 | false 16 | false 17 | 18 | -------------------------------------------------------------------------------- /test/Common/Types/StreetAddress.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Test.Amqp 19 | { 20 | using global::Amqp.Serialization; 21 | 22 | [AmqpContract(Name = "test.amqp:address", Code = 0x0000123400000003)] 23 | class StreetAddress 24 | { 25 | [AmqpMember] 26 | public string FullAddress; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /netmf/NetMF/Map.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Types 19 | { 20 | using System.Collections; 21 | 22 | /// 23 | /// Defines an AMQP map. 24 | /// 25 | public partial class Map : Hashtable 26 | { 27 | object GetValue(object key) 28 | { 29 | return base[key]; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Properties/Version.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | using System.Reflection; 19 | 20 | // Version information for an assembly consists of the following four values: 21 | // 22 | // Major Version 23 | // Minor Version 24 | // Build Number 25 | // Revision 26 | // 27 | [assembly: AssemblyVersion("2.5.0")] 28 | [assembly: AssemblyFileVersion("2.5.1")] 29 | [assembly: AssemblyInformationalVersion("2.5.1")] 30 | -------------------------------------------------------------------------------- /src/Amqp.WebSockets.Client.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | netstandard1.3;netstandard2.0 4 | Amqp.WebSockets.Client 5 | AmqpNetLite.WebSockets 6 | true 7 | false 8 | ..\obj\$(Configuration)\$(MSBuildProjectName)\ 9 | ..\bin\$(Configuration)\$(MSBuildProjectName)\ 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/Serialization/OnSerializedAttribute.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Serialization 19 | { 20 | using System; 21 | 22 | /// 23 | /// When applied to a method, specifies that the method is called after serialization 24 | /// of an object. 25 | /// 26 | [AttributeUsage(AttributeTargets.Method, Inherited = false)] 27 | public sealed class OnSerializedAttribute : Attribute 28 | { 29 | } 30 | } -------------------------------------------------------------------------------- /test/Test.Amqp.Net/Test.Amqp.Net.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net48;net5.0 4 | Test.Amqp.Net 5 | Test.Amqp.Net 6 | true 7 | false 8 | $(DefineConstants);NETFX 9 | ..\obj\$(Configuration)\$(MSBuildProjectName)\ 10 | ..\bin\$(Configuration)\$(MSBuildProjectName)\ 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/Serialization/OnDeserializedAttribute.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Serialization 19 | { 20 | using System; 21 | 22 | /// 23 | /// When applied to a method, specifies that the method is called after 24 | /// deserialization of an object. 25 | /// 26 | [AttributeUsage(AttributeTargets.Method, Inherited = false)] 27 | public sealed class OnDeserializedAttribute : Attribute 28 | { 29 | } 30 | } -------------------------------------------------------------------------------- /src/Serialization/OnSerializingAttribute.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Serialization 19 | { 20 | using System; 21 | 22 | /// 23 | /// When applied to a method, specifies that the method is called during serialization 24 | /// of an object. 25 | /// 26 | [AttributeUsage(AttributeTargets.Method, Inherited = false)] 27 | public sealed class OnSerializingAttribute : Attribute 28 | { 29 | } 30 | } -------------------------------------------------------------------------------- /src/Serialization/OnDeserializingAttribute.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Serialization 19 | { 20 | using System; 21 | 22 | /// 23 | /// When applied to a method, specifies that the method is called during 24 | /// deserialization of an object. 25 | /// 26 | [AttributeUsage(AttributeTargets.Method, Inherited = false)] 27 | public sealed class OnDeserializingAttribute : Attribute 28 | { 29 | } 30 | } -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Welcome to Amqp.Net Lite Website! 3 | documentType: index 4 | --- 5 |
6 |
7 |
8 | Amqp.Net Lite 9 |
10 | 13 |
14 | AMQP 1.0 library for .Net 15 |
16 | 20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |

AMQP on .Net

28 |

AMQP.Net Lite is a lightweight AMQP 1.0 library for the .Net Micro Framework, .NET nanoFramework, .Net Compact Framework, .Net Framework, .Net Core, Windows Runtime platforms, and Mono. The library includes both a client and listener to enable peer to peer and broker based messaging.

29 |
30 |
31 |
32 |
33 |
34 | -------------------------------------------------------------------------------- /src/Net/Map.Net.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Types 19 | { 20 | using System.Collections.Generic; 21 | 22 | /// 23 | /// A Map class is an AMQP map. 24 | /// 25 | public partial class Map : Dictionary 26 | { 27 | object GetValue(object key) 28 | { 29 | object value; 30 | this.TryGetValue(key, out value); 31 | return value; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /test/TestAmqpBroker/TestAmqpBroker.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | netcoreapp3.1;net45;net48;net5.0 4 | ../../obj/$(Configuration)/$(MSBuildProjectName) 5 | ../../bin/$(Configuration)/$(MSBuildProjectName) 6 | false 7 | false 8 | false 9 | Exe 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/Listener/IAuthenticated.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Listener 19 | { 20 | using System.Security.Principal; 21 | 22 | /// 23 | /// Provides a principal through transport or SASL authentication. 24 | /// 25 | public interface IAuthenticated 26 | { 27 | /// 28 | /// Gets the Principal. 29 | /// 30 | IPrincipal Principal { get; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Examples/Device/Device.Controller/LocalizedStrings.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | using Device.Controller.Resources; 18 | 19 | namespace Device.Controller 20 | { 21 | /// 22 | /// Provides access to string resources. 23 | /// 24 | public class LocalizedStrings 25 | { 26 | private static AppResources _localizedResources = new AppResources(); 27 | 28 | public AppResources LocalizedResources { get { return _localizedResources; } } 29 | } 30 | } -------------------------------------------------------------------------------- /src/Amqp.Net.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net48;net5.0 4 | Amqp.Net 5 | Amqp 6 | AmqpNetLite 7 | true 8 | false 9 | $(DefineConstants);NETFX 10 | ..\obj\$(Configuration)\$(MSBuildProjectName)\ 11 | ..\bin\$(Configuration)\$(MSBuildProjectName)\ 12 | ..\bin\$(Configuration)\$(MSBuildProjectName)\$(AssemblyName).XML 13 | 14 | 15 | 16 | 17 | 18 | ResXFileCodeGenerator 19 | Net\SRAmqp.Designer.cs 20 | Amqp 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /docs/articles/tracing.md: -------------------------------------------------------------------------------- 1 | Tracing is important in troubleshooting and debugging. The library emits traces at different levels (from low to high): 2 | * Error 3 | * Warning 4 | * Information 5 | * Verbose 6 | * Frame 7 | * Buffer 8 | 9 | From Error to Verbose, a higher level includes the previous level(s). Frame level tracing outputs the incoming and outgoing AMQP protocol headers and frames. Buffer level tracing outputs the incoming and outgoing bytes. Both Frame and Buffer levels can be combined with other levels but the output can be more difficult to read. 10 | 11 | To enable tracing, set the trace level and a listener. For example, the following code writes AMQP frames to the system diagnostics trace in an .Net application. 12 | 13 | ``` 14 | Trace.TraceLevel = TraceLevel.Frame; 15 | Trace.TraceListener = (l, f, a) => System.Diagnostics.Trace.WriteLine(DateTime.Now.ToString("[hh:mm:ss.fff]") + " " + string.Format(f, a)); 16 | ``` 17 | 18 | By implementing the trace listener delegate, you can write the traces to your application's tracing module. 19 | 20 | The library uses a conditional compilation symbol, TRACE, to enable/disable tracing calls. By default, this symbol is defined for both Debug and Release build. This means that the strings for the type/field names are included in the assembly. If you need to reduce the assembly size, you may remove the TRACE symbol and compile the project to get a smaller assembly (for NETMF devices). 21 | -------------------------------------------------------------------------------- /test/Common/TestHandler.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 3 | // file except in compliance with the License. You may obtain a copy of the License at 4 | // http://www.apache.org/licenses/LICENSE-2.0 5 | // 6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 7 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 8 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 9 | // NON-INFRINGEMENT. 10 | // 11 | // See the Apache Version 2.0 License for specific language governing permissions and 12 | // limitations under the License. 13 | // ------------------------------------------------------------------------------------ 14 | 15 | using System; 16 | using Amqp.Handler; 17 | 18 | namespace Test.Amqp 19 | { 20 | public class TestHandler : IHandler 21 | { 22 | readonly Action action; 23 | 24 | public TestHandler(Action action) 25 | { 26 | this.action = action; 27 | } 28 | 29 | bool IHandler.CanHandle(EventId id) 30 | { 31 | return true; 32 | } 33 | 34 | void IHandler.Handle(Event protocolEvent) 35 | { 36 | this.action(protocolEvent); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /nanoFramework/Test.Amqp.nanoFramework/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CSharp.BlankApplication")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CSharp.BlankApplication")] 13 | [assembly: AssemblyCopyright("Copyright © ")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | -------------------------------------------------------------------------------- /src/Types/IStringDecoder.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Types 19 | { 20 | using System; 21 | 22 | /// 23 | /// The interface defines the method to decode strings from a binary buffer. This can be used to implement custom string pooling. 24 | /// 25 | public interface IStringDecoder 26 | { 27 | /// 28 | /// Reads a string from a buffer. 29 | /// 30 | /// The buffer to read from. 31 | string DecodeString(ArraySegment buffer); 32 | } 33 | } -------------------------------------------------------------------------------- /netmf/NetMF/TimeoutException.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp 19 | { 20 | using System; 21 | 22 | /// 23 | /// The exception that is thrown when the time allotted for a process or operation 24 | /// has expired. 25 | /// 26 | public class TimeoutException : Exception 27 | { 28 | /// 29 | /// Initializes a new instance of the System.TimeoutException class. 30 | /// 31 | public TimeoutException(string message) 32 | : base(message) 33 | { 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Examples/Device/Device.SmallMemory.nanoFramework/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Device.SmallMemory")] 9 | [assembly: AssemblyDescription("AMQP Lite Device SmallMemory example project for nanoFramework platform")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Device.SmallMemory")] 13 | [assembly: AssemblyCopyright("Copyright © 2018")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | -------------------------------------------------------------------------------- /Examples/Device/Device.Thermometer.nanoFramework/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Device.Thermometer")] 9 | [assembly: AssemblyDescription("AMQP Lite Device Thermometer example project for nanoFramework platform")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Device.SmallMemory")] 13 | [assembly: AssemblyCopyright("Copyright © 2018")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | -------------------------------------------------------------------------------- /Examples/ServiceBus/ServiceBus.EventHub.nanoFramework/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ServiceBus.EventHub")] 9 | [assembly: AssemblyDescription("AMQP Lite Servicebus EventHub example project for nanoFramework")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ServiceBus.EventHub")] 13 | [assembly: AssemblyCopyright("Copyright © 2018")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | -------------------------------------------------------------------------------- /src/Listener/ContextState.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Listener 19 | { 20 | /// 21 | /// The state of a context. 22 | /// 23 | public enum ContextState 24 | { 25 | /// 26 | /// The context is active. 27 | /// 28 | Active = 0, 29 | 30 | /// 31 | /// The context is completed. 32 | /// 33 | Completed = 1, 34 | 35 | /// 36 | /// The context is aborted due to transport errors. 37 | /// 38 | Aborted = 2 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Serialization/SerializableMember.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Serialization 19 | { 20 | sealed class SerializableMember 21 | { 22 | public string Name 23 | { 24 | get; 25 | set; 26 | } 27 | 28 | public int Order 29 | { 30 | get; 31 | set; 32 | } 33 | 34 | public MemberAccessor Accessor 35 | { 36 | get; 37 | set; 38 | } 39 | 40 | public SerializableType Type 41 | { 42 | get; 43 | set; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.sln.docstates 8 | .vs/ 9 | 10 | # Build results 11 | [Dd]ebug/ 12 | [Dd]ebugPublic/ 13 | [Rr]elease/ 14 | [Rr]eleases/ 15 | x64/ 16 | build/ 17 | bld/ 18 | [Bb]in/ 19 | [Oo]bj/ 20 | docs/api/ 21 | 22 | # Roslyn cache directories 23 | *.ide/ 24 | 25 | # MSTest test Results 26 | [Tt]est[Rr]esult*/ 27 | [Bb]uild[Ll]og.* 28 | 29 | # Visual Studio profiler 30 | *.psess 31 | *.vsp 32 | *.vspx 33 | 34 | # NuGet Packages 35 | packages/* 36 | *.nupkg 37 | *.nuget.cache 38 | ## TODO: If the tool you use requires repositories.config 39 | ## uncomment the next line 40 | #!packages/repositories.config 41 | 42 | # Enable "build/" folder in the NuGet Packages folder since 43 | # NuGet packages use it for MSBuild targets. 44 | # This line needs to be after the ignore of the build folder 45 | # (and the packages folder if the line above has been uncommented) 46 | !packages/build/ 47 | 48 | # Windows Store app package directory 49 | AppPackages/ 50 | 51 | # Backup & report files from converting an old project file 52 | # to a newer Visual Studio version. Backup files are not needed, 53 | # because we have git ;-) 54 | _UpgradeReport_Files/ 55 | Backup*/ 56 | UpgradeLog*.XML 57 | UpgradeLog*.htm 58 | 59 | # .NET Micro Framework Emulator files and folders 60 | OnBoardFlash.dat 61 | OnBoardFlash.dat.smd 62 | DOTNETMF_FS_EMULATION*/ 63 | 64 | # dnx 65 | *project.lock.json 66 | .idea/ 67 | -------------------------------------------------------------------------------- /src/Serialization/IContractResolver.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Serialization 19 | { 20 | using System; 21 | 22 | /// 23 | /// Resolves a given type to the AMQP contract for serialization. 24 | /// 25 | public interface IContractResolver 26 | { 27 | /// 28 | /// Resolves a type to the AMQP contract. 29 | /// 30 | /// The type to resolve. 31 | /// An that controls the serialization of the given type. 32 | AmqpContract Resolve(Type type); 33 | } 34 | } -------------------------------------------------------------------------------- /src/Listener/IRequestProcessor.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Listener 19 | { 20 | /// 21 | /// Defines the methods of a request processor. 22 | /// 23 | public interface IRequestProcessor 24 | { 25 | /// 26 | /// Gets the link credit to issue to the sender client. 27 | /// 28 | int Credit { get; } 29 | 30 | /// 31 | /// Processes a received request. 32 | /// 33 | /// Context of the received request. 34 | void Process(RequestContext requestContext); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /test/Test.Amqp.NetFX40/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Test.Amqp.Net40")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Test.Amqp.Net40")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("a7373d36-1d1d-458c-92a5-c560a8532f62")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/Listener/IMessageProcessor.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Listener 19 | { 20 | /// 21 | /// Defines the property and methods of a message processor. 22 | /// 23 | public interface IMessageProcessor 24 | { 25 | /// 26 | /// Gets the link credit to issue to the client. 27 | /// 28 | int Credit { get; } 29 | 30 | /// 31 | /// Processes a received message. 32 | /// 33 | /// Context of the received message. 34 | void Process(MessageContext messageContext); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Examples/Reconnect/ReconnectSender/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("HelloReconnect2")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("HelloReconnect2")] 13 | [assembly: AssemblyCopyright("Copyright © 2018")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("edd03052-3a73-4d9e-9b94-6844134babfb")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/CreditMode.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp 19 | { 20 | /// 21 | /// Defines the modes for receiver link credit management. 22 | /// 23 | public enum CreditMode 24 | { 25 | /// 26 | /// Link credit is manually restored. 27 | /// 28 | Manual, 29 | /// 30 | /// Link credit is managed by the based on initial credit 31 | /// and message operations. 32 | /// 33 | Auto, 34 | /// 35 | /// Link credit is drained. 36 | /// 37 | Drain, 38 | }; 39 | } -------------------------------------------------------------------------------- /Examples/PeerToPeer/PeerToPeer.Client/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("PeerToPeer.Client")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("PeerToPeer.Client")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("3f7eff2d-c9f0-4131-a5f2-09167b969c02")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/Framing/ReceiverSettleMode.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Framing 19 | { 20 | /// 21 | /// Defines the settlement policy for a receiver. 22 | /// 23 | public enum ReceiverSettleMode : byte 24 | { 25 | /// 26 | /// The Receiver will spontaneously settle all incoming transfers. 27 | /// 28 | First = 0, 29 | 30 | /// 31 | /// The receiver will only settle after sending the disposition to the sender and 32 | /// receiving a disposition indicating settlement of the delivery from the sender. 33 | /// 34 | Second = 1 35 | } 36 | } -------------------------------------------------------------------------------- /Examples/Serialization/Serialization.Poco/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Serialization.Poco")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Serialization.Poco")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("3f7eff2d-c9f0-4131-a5f2-09167b969c02")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /docs/articles/test_amqp_broker.md: -------------------------------------------------------------------------------- 1 | The TestAmqpBroker project is built on top of the .Net version of this library. You can run all MSTest tests in the solution and the NETMF tests against this broker. 2 | 3 | ## Usage: 4 | ``` 5 | AmqpTestBroker url [url] [/creds:user:pwd] [/cert:ssl_cert] [/trace:level] [/queues:q1;q2;...] 6 | url=amqp|amqps://host[:port] (can be multiple) 7 | creds=username:passwrod 8 | cert=ssl cert find value (thumbprint or subject) 9 | trace=level (info, warn, error, frame) 10 | queues: semicolon separated queue names. If not specified, the broker implicitly 11 | creates a new node and deletes it when the connection is closed. 12 | ``` 13 | 14 | At least one Uri should be specified. Multiple are allowed (typically one for "amqp" and one for "amqps"). 15 | 16 | If "amqps" Uri is present, the "cert" option must exist to specify a server certificate for the Tls listener. 17 | 18 | If "queues" option is present, the broker is preconfigured with a list of queues. If it does not exist, the broker implicitly creates a queue upon the first attach request 19 | and deletes it when the last connection is closed. This allows running the tests easily without creating or draining the queue. Note that this is different from AMQP dynamic nodes. 20 | You can still create dynamic nodes through the protocol. 21 | 22 | When "trace" option is specified, the traces will be printed to the console window. 23 | 24 | Example (for running tests): 25 | ``` 26 | TestAmqpBroker.exe amqp://localhost:5672 amqps://localhost:5671 ws://localhost:80 /cert:localhost /creds:guest:guest /trace:frame 27 | ``` 28 | -------------------------------------------------------------------------------- /nuspec/AMQPNetMicro.nanoFramework.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | AMQPNetMicro.nanoFramework 5 | A compact version of AMQP.Net Lite for nanoFramework 6 | 0.0.0 7 | xinchen 8 | Apache-2.0 9 | https://github.com/Azure/amqpnetlite 10 | 11 | false 12 | This is a compact version of AMQP.Net Lite for .Net nanoFramework on memory/space constrained devices. 13 | docs\README.md 14 | Copyright 2014 15 | AMQP netmf nf nanoframework 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/Listener/ILinkProcessor.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Listener 19 | { 20 | /// 21 | /// Defines the property and methods of a link processor. 22 | /// 23 | public interface ILinkProcessor 24 | { 25 | /// 26 | /// Processes a received attach performative to open a link endpoint. The 27 | /// implementation must call attachContext.Complete to either accept or 28 | /// reject the attach performative. 29 | /// 30 | /// Context of the received attach performative. 31 | void Process(AttachContext attachContext); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Examples/PeerToPeer/PeerToPeer.CustomType/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("PeerToPeer.CustomType")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("PeerToPeer.CustomType")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("830ae910-dc69-486e-8534-2da58f9f0c39")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Examples/PeerToPeer/PeerToPeer.CustomTransport/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("PeerToPeer.CustomType")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("PeerToPeer.CustomType")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("830ae910-dc69-486e-8534-2da58f9f0c39")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /test/Common/ArgumentAttribute.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Test.Common 19 | { 20 | using System; 21 | 22 | [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] 23 | class ArgumentAttribute : Attribute 24 | { 25 | public string Name 26 | { 27 | get; 28 | set; 29 | } 30 | 31 | public string Shortcut 32 | { 33 | get; 34 | set; 35 | } 36 | 37 | public string Description 38 | { 39 | get; 40 | set; 41 | } 42 | 43 | public object Default 44 | { 45 | get; 46 | set; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /test/Test.Amqp.NetCoreApp/Test.Amqp.NetCoreApp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | $(DefineConstants);DOTNET 6 | false 7 | false 8 | ../../bin/$(Configuration)/$(MSBuildProjectName) 9 | Test.Amqp.Net 10 | Test.Amqp.Net 11 | 12 | 13 | $(DefineConstants);BUILD_SCRIPT 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/Framing/Outcome.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Framing 19 | { 20 | using Amqp.Types; 21 | 22 | /// 23 | /// Outcome is a terminal delivery-state of a delivery. 24 | /// 25 | public abstract class Outcome : DeliveryState 26 | { 27 | /// 28 | /// Initializes the outcome object. 29 | /// 30 | /// The descriptor of the concrete outcome class. 31 | /// The number of fields of the concrete outcome class. 32 | protected Outcome(Descriptor descriptor, int fieldCount) 33 | : base(descriptor, fieldCount) 34 | { 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /docs/articles/installation.md: -------------------------------------------------------------------------------- 1 | The library is installed to the application projects through the NuGet packages. 2 | 3 | ## NuGet Packages 4 | 5 | The following NuGet packages are available. 6 | 7 | * __AMQPNetLite__ - the package containing the targets of all supported platforms. 8 | * __AMQPNetMicro__ - the package containing a compact version for NETMF. To reduce 9 | storage and memory footprints, this version has its own APIs and implementation 10 | that are specifically designed for memory and space constrained devices. 11 | * .Net Core packages - the packages for any netstandard1.3 compliant platforms. 12 | * __AMQPNetLite.Core__ - the core protocol implementation and the client/listener 13 | APIs. 14 | * __AMQPNetLite.Serialization__ - the AMQP Serializer that serializes custom 15 | types using the standard AMQP type system. 16 | * __AMQPNetLite.WebSockets__ - the WebSocket transport for the client. 17 | 18 | ## Installation 19 | 20 | To reference the library, install the corresponding NuGet package into the 21 | projects you are developing. 22 | 23 | ### Visual Studio 24 | 25 | Open Manage NuGet Packages window. Search for the package mentioned above for 26 | the platform of your application. Install the package. 27 | 28 | Alternatively, open Package Manager Console and execute the following command. 29 | ``` 30 | Install-Package AmqpNetLite -ProjectName YourProjectName 31 | ``` 32 | 33 | ### .Net Core cli 34 | 35 | If you develop with other editors and build with the cli tool chain, add the 36 | following to your project.json file. 37 | 38 | ``` 39 | "dependencies": { 40 | "AMQPNetLite.Core": "2.0.0", 41 | "Other.Dependency": "1.0.0" 42 | } 43 | ``` -------------------------------------------------------------------------------- /netmf/NetMFLite/Link.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp 19 | { 20 | using Amqp.Types; 21 | 22 | /// 23 | /// Defines an AMQP link. 24 | /// 25 | public abstract class Link 26 | { 27 | /// 28 | /// The link name. 29 | /// 30 | public string Name; 31 | 32 | internal bool Role; 33 | 34 | internal byte State; 35 | 36 | internal uint Handle; 37 | 38 | internal uint RemoteHandle; 39 | 40 | internal abstract void OnAttach(List fields); 41 | 42 | internal abstract void OnFlow(List fields); 43 | 44 | internal abstract void OnDisposition(uint first, uint last, DescribedValue state); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Examples/ServiceBus/ServiceBus.Cbs/Program.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace ServiceBus.Cbs 19 | { 20 | using System; 21 | using Amqp; 22 | using ServiceBus.Scenarios; 23 | 24 | class Program 25 | { 26 | static void Main(string[] args) 27 | { 28 | Trace.TraceLevel = TraceLevel.Information; 29 | Trace.TraceListener = (l, f, a) => Console.WriteLine(DateTime.Now.ToString("[hh:mm:ss.fff]") + " " + string.Format(f, a)); 30 | 31 | try 32 | { 33 | new CbsAsyncExample().Run(); 34 | } 35 | catch (Exception e) 36 | { 37 | Trace.WriteLine(TraceLevel.Error, e.ToString()); 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Examples/ServiceBus/ServiceBus.Topic/Program.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace ServiceBus.Topic 19 | { 20 | using System; 21 | using Amqp; 22 | using ServiceBus.Scenarios; 23 | 24 | class Program 25 | { 26 | static void Main(string[] args) 27 | { 28 | Trace.TraceLevel = TraceLevel.Information; 29 | Trace.TraceListener = (l, f, a) => Console.WriteLine(DateTime.Now.ToString("[hh:mm:ss.fff]") + " " + string.Format(f, a)); 30 | 31 | try 32 | { 33 | new TopicExample().Run(); 34 | } 35 | catch (Exception e) 36 | { 37 | Trace.WriteLine(TraceLevel.Error, e.ToString()); 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Examples/ServiceBus/ServiceBus.WebSockets/Program.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace ServiceBus.Topic 19 | { 20 | using System; 21 | using Amqp; 22 | using ServiceBus.Scenarios; 23 | 24 | class Program 25 | { 26 | static void Main(string[] args) 27 | { 28 | Trace.TraceLevel = TraceLevel.Frame; 29 | Trace.TraceListener = (l, f, a) => Console.WriteLine(DateTime.Now.ToString("[hh:mm:ss.fff]") + " " + string.Format(f, a)); 30 | 31 | try 32 | { 33 | new WebSocketsExample().Run(); 34 | } 35 | catch (Exception e) 36 | { 37 | Trace.WriteLine(TraceLevel.Error, e.ToString()); 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Framing/SenderSettleMode.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Framing 19 | { 20 | /// 21 | /// Defines the settlement policy for a sender. 22 | /// 23 | public enum SenderSettleMode : byte 24 | { 25 | /// 26 | /// The Sender will send all deliveries initially unsettled to the receiver. 27 | /// 28 | Unsettled = 0, 29 | 30 | /// 31 | /// The Sender will send all deliveries settled to the receiver. 32 | /// 33 | Settled = 1, 34 | 35 | /// 36 | /// The sender may send a mixture of settled and unsettled deliveries to the receiver. 37 | /// 38 | Mixed = 2 39 | } 40 | } -------------------------------------------------------------------------------- /src/Handler/IHandler.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Handler 19 | { 20 | /// 21 | /// A handler to receive protocol events. 22 | /// 23 | public interface IHandler 24 | { 25 | /// 26 | /// Checks if the handler can handle a given event. 27 | /// 28 | /// The . 29 | /// true if the event can be handled; false otherwise. 30 | bool CanHandle(EventId id); 31 | 32 | /// 33 | /// Handles a protocol event. 34 | /// 35 | /// The procotol event. 36 | void Handle(Event protocolEvent); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Examples/ServiceBus/ServiceBus.EventHub/Program.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace ServiceBus.EventHub 19 | { 20 | using System; 21 | using Amqp; 22 | using ServiceBus.Scenarios; 23 | 24 | class Program 25 | { 26 | static void Main(string[] args) 27 | { 28 | Trace.TraceLevel = TraceLevel.Information; 29 | Trace.TraceListener = (l, f, a) => Console.WriteLine(DateTime.Now.ToString("[hh:mm:ss.fff]") + " " + string.Format(f, a)); 30 | 31 | try 32 | { 33 | new EventHubsExample().Run(); 34 | } 35 | catch (Exception e) 36 | { 37 | Trace.WriteLine(TraceLevel.Error, e.ToString()); 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Examples/ServiceBus/ServiceBus.EventHub.NetMF/Program.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | using System; 19 | using Amqp; 20 | using Microsoft.SPOT; 21 | using ServiceBus.Scenarios; 22 | using AmqpTrace = Amqp.Trace; 23 | 24 | namespace ServiceBus.EventHub.NetMF 25 | { 26 | public class Program 27 | { 28 | public static void Main() 29 | { 30 | AmqpTrace.TraceLevel = TraceLevel.Information; 31 | AmqpTrace.TraceListener = (l, f, a) => Debug.Print(Fx.Format(f, a)); 32 | 33 | try 34 | { 35 | new EventHubsExample().Run(); 36 | } 37 | catch (Exception e) 38 | { 39 | AmqpTrace.WriteLine(TraceLevel.Error, e.ToString()); 40 | } 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /src/Serialization/AmqpMember.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Serialization 19 | { 20 | using System.Reflection; 21 | 22 | /// 23 | /// Represents an AMQP member (a field or a property) within a contract. 24 | /// 25 | public class AmqpMember 26 | { 27 | /// 28 | /// The attribute on the member. 29 | /// 30 | public AmqpMemberAttribute Attribute { get; set; } 31 | 32 | /// 33 | /// The member info provided by the system. 34 | /// 35 | public MemberInfo Info { get; set; } 36 | 37 | internal string Name { get { return this.Attribute.Name ?? this.Info.Name; } } 38 | 39 | internal int Order { get; set; } 40 | } 41 | } -------------------------------------------------------------------------------- /src/Net/List.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Types 19 | { 20 | using System.Collections.Generic; 21 | 22 | /// 23 | /// A List class is an AMQP list. 24 | /// 25 | public class List : List 26 | { 27 | 28 | /// 29 | /// Initializes a new instance of the class. 30 | /// 31 | public List() 32 | { 33 | } 34 | 35 | /// 36 | /// Initializes a new instance of the class. 37 | /// 38 | /// The number of elements that the new list can initially store. 39 | public List(int capacity) : base(capacity) 40 | { 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /nuspec/AMQPNetLite.nanoFramework.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | AMQPNetLite.nanoFramework 5 | AMQP.Net Lite for nanoFramework 6 | 0.0.0 7 | xinchen 8 | Apache-2.0 9 | https://github.com/Azure/amqpnetlite 10 | 11 | false 12 | 13 | This is a lightweight AMQP library for .Net nanoFramework. A more compact version 14 | is available in the AMQPNetMicro.nanoFramework package. 15 | 16 | docs\README.md 17 | Copyright 2014 18 | AMQP net netmf nf nanoframework 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/Amqp.Serialization.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | netstandard1.3 4 | Amqp.Serialization 5 | AmqpNetLite.Serialization 6 | true 7 | false 8 | $(DefineConstants);DOTNET;DOTNET_SERIALIZATION 9 | ..\obj\$(Configuration)\$(MSBuildProjectName)\ 10 | ..\bin\$(Configuration)\$(MSBuildProjectName)\ 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/Listener/DispositionContext.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Listener 19 | { 20 | using Amqp.Framing; 21 | 22 | /// 23 | /// Provides the context to a link endpoint to process the received disposition. 24 | /// 25 | public class DispositionContext : MessageContext 26 | { 27 | internal DispositionContext(ListenerLink link, Message message, DeliveryState deliveryState, bool settled) 28 | : base(link, message) 29 | { 30 | this.Settled = settled; 31 | } 32 | 33 | /// 34 | /// Gets the settled state sent in the disposition. 35 | /// 36 | public bool Settled 37 | { 38 | get; 39 | private set; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /test/Common/MessageBatch.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 3 | // file except in compliance with the License. You may obtain a copy of the License at 4 | // http://www.apache.org/licenses/LICENSE-2.0 5 | // 6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 7 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 8 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 9 | // NON-INFRINGEMENT. 10 | // 11 | // See the Apache Version 2.0 License for specific language governing permissions and 12 | // limitations under the License. 13 | // ------------------------------------------------------------------------------------ 14 | 15 | using Amqp; 16 | using Amqp.Framing; 17 | using Amqp.Serialization; 18 | using System.Collections.Generic; 19 | 20 | namespace Test.Amqp 21 | { 22 | public class MessageBatch : Message 23 | { 24 | public const uint BatchFormat = 0x80013700; 25 | 26 | public static MessageBatch Create(IEnumerable objects) 27 | { 28 | DataList dataList = new DataList(); 29 | foreach (var obj in objects) 30 | { 31 | ByteBuffer buffer = new ByteBuffer(1024, true); 32 | var section = new AmqpValue(obj); 33 | AmqpSerializer.Serialize(buffer, section); 34 | dataList.Add(new Data() { Buffer = buffer }); 35 | } 36 | 37 | return new MessageBatch() { Format = BatchFormat, BodySection = dataList }; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Serialization/EncodingType.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Serialization 19 | { 20 | /// 21 | /// Defines the encoding type of an AMQP serializable type. 22 | /// 23 | public enum EncodingType 24 | { 25 | /// 26 | /// The type is encoded as an AMQP described list. 27 | /// 28 | List, 29 | 30 | /// 31 | /// The type is encoded as an AMQP described map. 32 | /// 33 | Map, 34 | 35 | /// 36 | /// The type is encoded as an AMQP map with string keys. 37 | /// 38 | SimpleMap, 39 | 40 | /// 41 | /// The type is encoded as an AMQP list with no descriptor. 42 | /// 43 | SimpleList, 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Framing/Footer.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Framing 19 | { 20 | using Amqp.Types; 21 | using System; 22 | 23 | /// 24 | /// The Footer class represents the footer section of a message. 25 | /// 26 | public sealed class Footer : DescribedMap 27 | { 28 | /// 29 | /// Initializes a footer section. 30 | /// 31 | public Footer() 32 | : base(Codec.Footer, typeof(Symbol)) 33 | { 34 | } 35 | 36 | #if TRACE 37 | /// 38 | /// Returns a string that represents the current footer object. 39 | /// 40 | /// 41 | public override string ToString() 42 | { 43 | return "footer:" + base.ToString(); 44 | } 45 | #endif 46 | } 47 | } -------------------------------------------------------------------------------- /Examples/ServiceBus/ServiceBus.MessageSession/Program.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace ServiceBus.MessageSession 19 | { 20 | using System; 21 | using Amqp; 22 | using ServiceBus.Scenarios; 23 | 24 | class Program 25 | { 26 | static void Main(string[] args) 27 | { 28 | Trace.TraceLevel = TraceLevel.Information; 29 | Trace.TraceListener = (l, f, a) => Console.WriteLine(DateTime.Now.ToString("[hh:mm:ss.fff]") + " " + string.Format(f, a)); 30 | 31 | try 32 | { 33 | // the queue should be created with RequiresSession=true 34 | new MessageSessionExample().Run(); 35 | } 36 | catch (Exception e) 37 | { 38 | Trace.WriteLine(TraceLevel.Error, e.ToString()); 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /nuspec/AMQPNetMicro.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | AMQPNetMicro 5 | A compact version of AMQP.Net Lite for NETMF 6 | 0.0.0 7 | xinchen 8 | Apache-2.0 9 | https://github.com/Azure/amqpnetlite 10 | 11 | false 12 | This is a compact version of AMQP.Net Lite for .Net Micro Framework on memory/space constrained devices. 13 | docs\README.md 14 | Copyright 2014 15 | AMQP netmf 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/Framing/DeliveryState.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Framing 19 | { 20 | using Amqp.Types; 21 | 22 | /// 23 | /// The Messaging layer defines a concrete set of delivery states which can be used 24 | /// to indicate the state of the message at the receiver. 25 | /// 26 | public abstract class DeliveryState : DescribedList 27 | { 28 | /// 29 | /// Initializes the delivery state object. 30 | /// 31 | /// The descriptor of the concrete delivery state class. 32 | /// The number of fields of the concrete delivery state class. 33 | protected DeliveryState(Descriptor descriptor, int fieldCount) 34 | : base(descriptor, fieldCount) 35 | { 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | using System.Reflection; 19 | using System.Runtime.InteropServices; 20 | 21 | // General Information about an assembly is controlled through the following 22 | // set of attributes. Change these attribute values to modify the information 23 | // associated with an assembly. 24 | [assembly: AssemblyTitle("Amqp 1.0")] 25 | [assembly: AssemblyDescription("AMQP 1.0 .Net Library")] 26 | [assembly: AssemblyConfiguration("")] 27 | [assembly: AssemblyProduct("Amqp")] 28 | [assembly: AssemblyCopyright("Copyright © 2013")] 29 | [assembly: AssemblyTrademark("")] 30 | [assembly: AssemblyCulture("")] 31 | 32 | // Setting ComVisible to false makes the types in this assembly not visible 33 | // to COM components. If you need to access a type in this assembly from 34 | // COM, set the ComVisible attribute to true on that type. 35 | [assembly: ComVisible(false)] 36 | -------------------------------------------------------------------------------- /src/WinRT/Timer.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace System.Threading 19 | { 20 | using global::Windows.System.Threading; 21 | 22 | delegate void TimerCallback(object state); 23 | 24 | class Timer 25 | { 26 | readonly TimerCallback callback; 27 | readonly object state; 28 | readonly ThreadPoolTimer timer; 29 | 30 | public Timer(TimerCallback callback, object state, int dueTime, int period) 31 | { 32 | this.callback = callback; 33 | this.state = state; 34 | this.timer = ThreadPoolTimer.CreatePeriodicTimer(this.OnTimer, TimeSpan.FromMilliseconds(dueTime)); 35 | } 36 | 37 | public void Dispose() 38 | { 39 | this.timer.Cancel(); 40 | } 41 | 42 | void OnTimer(ThreadPoolTimer t) 43 | { 44 | this.callback(this.state); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /netmf/NetMF/List.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Types 19 | { 20 | using System.Collections; 21 | 22 | /// 23 | /// A List class is an AMQP list. 24 | /// 25 | public class List : ArrayList 26 | { 27 | /// 28 | /// Initializes a new instance of the class. 29 | /// 30 | public List() 31 | { 32 | } 33 | 34 | /// 35 | /// Initializes a new instance of the class. 36 | /// 37 | /// The number of elements that the new list can initially store. 38 | public List(int capacity) : base() 39 | { 40 | // NOTE: NETMF ArrayList does not have a constructor that takes an int parameter, so we cannot set initial capacity in this case 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Examples/Device/Device.Thermometer/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.0 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Device.Thermometer 12 | { 13 | 14 | internal partial class Resources 15 | { 16 | private static System.Resources.ResourceManager manager; 17 | internal static System.Resources.ResourceManager ResourceManager 18 | { 19 | get 20 | { 21 | if ((Resources.manager == null)) 22 | { 23 | Resources.manager = new System.Resources.ResourceManager("Device.Thermometer.Resources", typeof(Resources).Assembly); 24 | } 25 | return Resources.manager; 26 | } 27 | } 28 | internal static Microsoft.SPOT.Font GetFont(Resources.FontResources id) 29 | { 30 | return ((Microsoft.SPOT.Font)(Microsoft.SPOT.ResourceUtility.GetObject(ResourceManager, id))); 31 | } 32 | internal static string GetString(Resources.StringResources id) 33 | { 34 | return ((string)(Microsoft.SPOT.ResourceUtility.GetObject(ResourceManager, id))); 35 | } 36 | [System.SerializableAttribute()] 37 | internal enum StringResources : short 38 | { 39 | String1 = 1228, 40 | } 41 | [System.SerializableAttribute()] 42 | internal enum FontResources : short 43 | { 44 | small = 13070, 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Framing/ApplicationProperties.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Framing 19 | { 20 | using Amqp.Types; 21 | 22 | /// 23 | /// The class defines the application properties section of an AMQP messages. 24 | /// 25 | public sealed class ApplicationProperties : DescribedMap 26 | { 27 | /// 28 | /// Initializes the application properties section. 29 | /// 30 | public ApplicationProperties() 31 | : base(Codec.ApplicationProperties, typeof(string)) 32 | { 33 | } 34 | 35 | #if TRACE 36 | /// 37 | /// Returns a string that represents the current object. 38 | /// 39 | /// 40 | public override string ToString() 41 | { 42 | return "app-properties:" + base.ToString(); 43 | } 44 | #endif 45 | } 46 | } -------------------------------------------------------------------------------- /src/Listener/ListenerSession.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Listener 19 | { 20 | using System; 21 | using Amqp.Framing; 22 | using Amqp.Types; 23 | 24 | /// 25 | /// An AMQP session used by the listener. 26 | /// 27 | public class ListenerSession : Session 28 | { 29 | internal ListenerSession(ListenerConnection connection, Begin begin) 30 | : base(connection, begin, null) 31 | { 32 | } 33 | 34 | internal override void OnAttach(Attach attach) 35 | { 36 | this.ValidateHandle(attach.Handle); 37 | 38 | var connection = (ListenerConnection)this.Connection; 39 | Link link = connection.Listener.Container.CreateLink(connection, this, attach); 40 | this.AddRemoteLink(attach.Handle, link); 41 | link.OnAttach(attach.Handle, attach); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Serialization/IAmqpSerializable.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Serialization 19 | { 20 | /// 21 | /// Specifies that a type is serializable by the AMQP serializer. 22 | /// 23 | public interface IAmqpSerializable 24 | { 25 | /// 26 | /// Gets the encode size in bytes of an instance. 27 | /// 28 | int EncodeSize 29 | { 30 | get; 31 | } 32 | 33 | /// 34 | /// Encodes the serializable object into a buffer. 35 | /// 36 | /// 37 | void Encode(ByteBuffer buffer); 38 | 39 | /// 40 | /// Decodes and initializes the serializable object from a buffer. 41 | /// 42 | /// The buffer to read. 43 | void Decode(ByteBuffer buffer); 44 | } 45 | } -------------------------------------------------------------------------------- /Examples/ServiceBus/Scenarios/Example.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace ServiceBus.Scenarios 19 | { 20 | using Amqp; 21 | 22 | abstract class Example 23 | { 24 | // Update the following with valid Service Bus namespace and SAS key info. 25 | // Entity should exist already under the specified Service Bus namespace. 26 | // The SAS policy should allow Send or Listen action for the given entity 27 | // or namespace as required by the sample. 28 | public string Namespace = "contoso.servicebus.windows.net"; 29 | public string KeyName = "key1"; 30 | public string KeyValue = "5znwNTZDYC39dqhFOTDtnaikd1hiuRa4XaAj3Y9kJhQ="; 31 | public string Entity = "myEntity"; 32 | 33 | public Address GetAddress() 34 | { 35 | return new Address(this.Namespace, 5671, this.KeyName, this.KeyValue); 36 | } 37 | 38 | public abstract void Run(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Net/WrappedByteBuffer.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp 19 | { 20 | using System; 21 | 22 | class WrappedByteBuffer : ByteBuffer 23 | { 24 | readonly ByteBuffer buffer; 25 | 26 | public WrappedByteBuffer(ByteBuffer buffer, int offset, int length) 27 | : base(buffer.Buffer, offset, length, length, false) 28 | { 29 | buffer.AddReference(); 30 | this.buffer = buffer; 31 | } 32 | 33 | internal override void DuplicateBuffer(int bufferSize, int dataSize, out byte[] buffer, out int offset, out int count) 34 | { 35 | throw new InvalidOperationException(); 36 | } 37 | 38 | internal override void AddReference() 39 | { 40 | this.buffer.AddReference(); 41 | } 42 | 43 | internal override void ReleaseReference() 44 | { 45 | this.buffer.ReleaseReference(); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Serialization/AmqpProvidesAttribute.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Serialization 19 | { 20 | using System; 21 | 22 | /// 23 | /// Specifies that the current type can be set to the provided type. 24 | /// 25 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, 26 | Inherited = true, AllowMultiple = true)] 27 | public sealed class AmqpProvidesAttribute : Attribute 28 | { 29 | readonly Type type; 30 | 31 | /// 32 | /// Initializes the attribute object. 33 | /// 34 | /// The provided type. 35 | public AmqpProvidesAttribute(Type type) 36 | { 37 | this.type = type; 38 | } 39 | 40 | /// 41 | /// Gets the provided type. 42 | /// 43 | public Type Type 44 | { 45 | get { return this.type; } 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /src/Net/IConnectionFactory.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp 19 | { 20 | using System.Threading.Tasks; 21 | 22 | /// 23 | /// The factory to create connections asynchronously. 24 | /// 25 | public interface IConnectionFactory 26 | { 27 | /// 28 | /// Creates a connection to the specified address. 29 | /// 30 | /// The address of a remote endpoint to connect to. 31 | /// A task for the creation operation. On success, the result is an 32 | Task CreateAsync(Address address); 33 | } 34 | 35 | public partial class ConnectionFactory : IConnectionFactory 36 | { 37 | async Task IConnectionFactory.CreateAsync(Address address) 38 | { 39 | return await this.CreateAsync(address, null, null).ConfigureAwait(false); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Examples/Serialization/Serialization.Poco/Shape.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Serialization.Poco 19 | { 20 | using System; 21 | using System.Collections.Generic; 22 | 23 | abstract class Shape 24 | { 25 | public Guid Id { get; set; } 26 | 27 | public Dictionary Attributes { get; set; } 28 | } 29 | 30 | class Circle : Shape 31 | { 32 | public double Radius { get; set; } 33 | 34 | public override string ToString() 35 | { 36 | return string.Format("{0}(id={1} r={2})", this.GetType().Name, this.Id, this.Radius); 37 | } 38 | } 39 | 40 | class Rectangle : Shape 41 | { 42 | public int Width { get; set; } 43 | 44 | public int Height { get; set; } 45 | 46 | public override string ToString() 47 | { 48 | return string.Format("{0}(id={1} w={2} h={3})", this.GetType().Name, this.Id, this.Width, this.Height); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Framing/DeliveryAnnotations.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Framing 19 | { 20 | using Amqp.Types; 21 | 22 | /// 23 | /// The delivery-annotations section is used for delivery-specific non-standard 24 | /// properties at the head of the message. 25 | /// 26 | public sealed class DeliveryAnnotations : DescribedMap 27 | { 28 | /// 29 | /// Initializes a delivery annotations section. 30 | /// 31 | public DeliveryAnnotations() 32 | : base(Codec.DeliveryAnnotations, typeof(Symbol)) 33 | { 34 | } 35 | 36 | #if TRACE 37 | /// 38 | /// Returns a string that represents the current delivery annotations object. 39 | /// 40 | /// 41 | public override string ToString() 42 | { 43 | return "delivery-annotations:" + base.ToString(); 44 | } 45 | #endif 46 | } 47 | } -------------------------------------------------------------------------------- /src/Net/IBufferManager.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp 19 | { 20 | using System; 21 | 22 | #if NETFX || NETFX40 || DOTNET 23 | /// 24 | /// The interface defines the methods to manage buffers. 25 | /// 26 | public 27 | #endif 28 | interface IBufferManager 29 | { 30 | /// 31 | /// Takes a buffer from the buffer manager. 32 | /// 33 | /// the buffer size. 34 | /// 35 | /// A segment of a byte array. The count should be the same, or larger 36 | /// than the requested bufferSize. 37 | /// 38 | ArraySegment TakeBuffer(int bufferSize); 39 | 40 | /// 41 | /// Returns a buffer to the buffer manager. 42 | /// 43 | /// The buffer to return. 44 | void ReturnBuffer(ArraySegment buffer); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /test/Test.Amqp.NetCore/Package.appxmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test.Amqp.NetCore 6 | amqpnetlite 7 | Images\UnitTestStoreLogo.png 8 | Test.Amqp.NetCore 9 | 10 | 11 | 6.3.0 12 | 6.3.0 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/Framing/MessageAnnotations.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Framing 19 | { 20 | using Amqp.Types; 21 | 22 | /// 23 | /// The message-annotations section is used for properties of the message which are 24 | /// aimed at the infrastructure and should be propagated across every delivery step. 25 | /// 26 | public sealed class MessageAnnotations : DescribedMap 27 | { 28 | /// 29 | /// Initializes a message annotations section. 30 | /// 31 | public MessageAnnotations() 32 | : base(Codec.MessageAnnotations, typeof(Symbol)) 33 | { 34 | } 35 | 36 | #if TRACE 37 | /// 38 | /// Returns a string that represents the current message annotations object. 39 | /// 40 | /// 41 | public override string ToString() 42 | { 43 | return "msg-annotations:" + base.ToString(); 44 | } 45 | #endif 46 | } 47 | } -------------------------------------------------------------------------------- /src/Listener/LinkCollection.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Listener 19 | { 20 | using System.Collections.Concurrent; 21 | 22 | class LinkCollection 23 | { 24 | readonly ConcurrentDictionary links; 25 | 26 | public LinkCollection(string containerId) 27 | { 28 | this.links = new ConcurrentDictionary(); 29 | } 30 | 31 | public bool TryAdd(ListenerLink link) 32 | { 33 | var key = LinkId.Create(link.Session.Connection, link.Role, link.Name); 34 | return this.links.TryAdd(key, link); 35 | } 36 | 37 | public bool Remove(ListenerLink link) 38 | { 39 | var key = LinkId.Create(link.Session.Connection, link.Role, link.Name); 40 | ListenerLink temp; 41 | return this.links.TryRemove(key, out temp); 42 | } 43 | 44 | public void Clear() 45 | { 46 | this.links.Clear(); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Listener/ReceiveContext.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Listener 19 | { 20 | using Amqp.Framing; 21 | 22 | /// 23 | /// Provides the context of a receive request. It is created by a message source 24 | /// to track the delivery of an outgoing message. 25 | /// 26 | public class ReceiveContext : Context 27 | { 28 | /// 29 | /// Initializes a ReceiveContext object. 30 | /// 31 | /// The listener link to send out the message. 32 | /// The message to send out. 33 | public ReceiveContext(ListenerLink link, Message message) 34 | : base(link, message) 35 | { 36 | } 37 | 38 | /// 39 | /// Gets or sets an object that is associated with the receive context. 40 | /// 41 | public object UserToken 42 | { 43 | get; 44 | set; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /test/Common/Types/Teacher.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Test.Amqp 19 | { 20 | using System.Collections.Generic; 21 | using global::Amqp.Serialization; 22 | 23 | [AmqpContract(Name = "test.amqp:teacher", Code = 0x0000123400000002)] 24 | class Teacher : Person 25 | { 26 | public Teacher() { } 27 | 28 | public Teacher(string name) 29 | : base(name) 30 | { 31 | this.Id = EmployeeId.New(); 32 | } 33 | 34 | [AmqpMember(Name = "sallary", Order = 4)] 35 | public int Sallary; 36 | 37 | [AmqpMember(Order = 10)] 38 | public EmployeeId Id 39 | { 40 | get; 41 | private set; 42 | } 43 | 44 | [AmqpMember(Order = 11)] 45 | public Dictionary Classes 46 | { 47 | get; 48 | set; 49 | } 50 | 51 | [OnDeserialized] 52 | void OnDesrialized() 53 | { 54 | this.Sallary *= 2; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Examples/Device/Device.Thermometer/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | using System.Reflection; 18 | using System.Runtime.CompilerServices; 19 | using System.Runtime.InteropServices; 20 | 21 | // General Information about an assembly is controlled through the following 22 | // set of attributes. Change these attribute values to modify the information 23 | // associated with an assembly. 24 | [assembly: AssemblyTitle("MFWindowApplication1")] 25 | [assembly: AssemblyDescription("")] 26 | [assembly: AssemblyConfiguration("")] 27 | [assembly: AssemblyCompany("")] 28 | [assembly: AssemblyProduct("MFWindowApplication1")] 29 | [assembly: AssemblyCopyright("Copyright © 2013")] 30 | [assembly: AssemblyTrademark("")] 31 | [assembly: AssemblyCulture("")] 32 | 33 | // Version information for an assembly consists of the following four values: 34 | // 35 | // Major Version 36 | // Minor Version 37 | // Build Number 38 | // Revision 39 | // 40 | [assembly: AssemblyVersion("1.0.0.0")] 41 | [assembly: AssemblyFileVersion("1.0.0.0")] 42 | -------------------------------------------------------------------------------- /test/Common/Types/Specification.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Test.Amqp 19 | { 20 | using global::Amqp.Serialization; 21 | 22 | [AmqpContract(Name = "test.amqp:specification", Encoding = EncodingType.Map)] 23 | [AmqpProvides(typeof(ComputerSpecification))] 24 | [AmqpProvides(typeof(CarSpecification))] 25 | abstract class Specification 26 | { 27 | [AmqpMember] 28 | public string Description { get; set; } 29 | } 30 | 31 | [AmqpContract(Name = "test.amqp:computer-specification", Encoding = EncodingType.Map)] 32 | class ComputerSpecification : Specification 33 | { 34 | [AmqpMember] 35 | public int Cores; 36 | 37 | [AmqpMember] 38 | public int RamSize; 39 | } 40 | 41 | [AmqpContract(Name = "test.amqp:automotive-specification", Encoding = EncodingType.Map)] 42 | class CarSpecification : Specification 43 | { 44 | [AmqpMember] 45 | public string Engine; 46 | 47 | [AmqpMember] 48 | public int HorsePower; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /nuspec/AMQPNetLite.Serialization.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | AMQPNetLite.Serialization 5 | AMQP.Net Lite AMQP Serializer on .Net Core 6 | 0.0.0 7 | xinchen 8 | Apache-2.0 9 | https://github.com/Azure/amqpnetlite 10 | 11 | false 12 | This package provides the AMQP Serializer of AMQP.Net Lite on .Net Core (netstandard1.3). 13 | docs\README.md 14 | Copyright 2014 15 | AMQP coreclr .NetCore netstandard serialization 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/Sasl/SaslCode.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Sasl 19 | { 20 | /// 21 | /// Codes to indicate the outcome of the SASL dialog. 22 | /// 23 | public enum SaslCode : byte 24 | { 25 | /// 26 | /// Connection authentication succeeded. 27 | /// 28 | Ok = 0, 29 | 30 | /// 31 | /// Connection authentication failed due to an unspecified problem with the supplied credentials. 32 | /// 33 | Auth = 1, 34 | 35 | /// 36 | /// Connection authentication failed due to a system error. 37 | /// 38 | Sys = 2, 39 | 40 | /// 41 | /// Connection authentication failed due to a system error that is unlikely to be corrected without intervention. 42 | /// 43 | SysPerm = 3, 44 | 45 | /// 46 | /// Connection authentication failed due to a transient system error. 47 | /// 48 | SysTemp = 4 49 | } 50 | } -------------------------------------------------------------------------------- /netmf/Test/Program.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | using Amqp; 18 | #if NETMF && !NANOFRAMEWORK_1_0 19 | using Microsoft.SPOT; 20 | #elif NANOFRAMEWORK_1_0 21 | using System.Diagnostics; 22 | #endif 23 | #if COMPACT_FRAMEWORK 24 | using System.Diagnostics; 25 | #endif 26 | using AmqpTrace = Amqp.Trace; 27 | 28 | namespace Test.Amqp 29 | { 30 | public class Program 31 | { 32 | public static int Main() 33 | { 34 | AmqpTrace.TraceLevel = TraceLevel.Output; 35 | AmqpTrace.TraceListener = Program.WriteTrace; 36 | Connection.DisableServerCertValidation = true; 37 | 38 | return TestRunner.RunTests(); 39 | } 40 | 41 | static void WriteTrace(TraceLevel level, string format, params object[] args) 42 | { 43 | string message = args == null ? format : Fx.Format(format, args); 44 | #if NETMF && !NANOFRAMEWORK_1_0 45 | Debug.Print(message); 46 | #elif NANOFRAMEWORK_1_0 47 | Debug.WriteLine(message); 48 | #elif COMPACT_FRAMEWORK 49 | Debug.WriteLine(message); 50 | #endif 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Net/TransportProvider.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp 19 | { 20 | using System; 21 | using System.Threading.Tasks; 22 | 23 | /// 24 | /// The TransportProvider class provides transport implementation for given address schemes. 25 | /// 26 | public abstract class TransportProvider : IDisposable 27 | { 28 | /// 29 | /// Gets or sets the supported address schemes. 30 | /// 31 | public string[] AddressSchemes { get; protected set; } 32 | 33 | /// 34 | /// Creates a transport for the given address. 35 | /// 36 | /// The address to connect. 37 | /// An IAsyncTransport object representing the transport. 38 | public abstract Task CreateAsync(Address address); 39 | 40 | /// 41 | /// Disposes the provider and release any associated resources. 42 | /// 43 | public virtual void Dispose() 44 | { 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/ITransport.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp 19 | { 20 | using System; 21 | 22 | /// 23 | /// The transport interface used by a connection for network I/O. 24 | /// 25 | public interface ITransport 26 | { 27 | /// 28 | /// Sends a buffer. 29 | /// 30 | /// The buffer to send. 31 | void Send(ByteBuffer buffer); 32 | 33 | /// 34 | /// Receives a buffer. 35 | /// 36 | /// The buffer to store the received bytes. 37 | /// The start position. 38 | /// The number of bytes to receive. 39 | /// The number of bytes received. It may be less than . 40 | /// A value of 0 means that the transport is closed. 41 | int Receive(byte[] buffer, int offset, int count); 42 | 43 | /// 44 | /// Closes the transport. 45 | /// 46 | void Close(); 47 | } 48 | } -------------------------------------------------------------------------------- /src/Handler/IDelivery.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Handler 19 | { 20 | using Amqp.Framing; 21 | 22 | /// 23 | /// A delivery contains the state for transfering a message. 24 | /// The properties must not be changed on a received delivery. 25 | /// between nodes. 26 | /// 27 | public interface IDelivery 28 | { 29 | /// 30 | /// Gets or sets the delivery tag. 31 | /// 32 | byte[] Tag { get; set; } 33 | 34 | /// 35 | /// Gets or sets the delivery state. 36 | /// 37 | DeliveryState State { get; set; } 38 | 39 | /// 40 | /// Gets or sets the batchable field. 41 | /// 42 | bool Batchable { get; set; } 43 | 44 | /// 45 | /// Gets the user state object if set in the send method. 46 | /// 47 | object UserToken { get; } 48 | 49 | /// 50 | /// Gets or sets the Settled field. 51 | /// 52 | bool Settled { get; set; } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Framing/AmqpSequence.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Framing 19 | { 20 | using System.Collections; 21 | using Amqp.Types; 22 | 23 | /// 24 | /// A sequence section contains an arbitrary number of structured data elements. 25 | /// 26 | public sealed class AmqpSequence : RestrictedDescribed 27 | { 28 | /// 29 | /// Initializes an AmqpSequence object. 30 | /// 31 | public AmqpSequence() 32 | : base(Codec.AmqpSequence) 33 | { 34 | } 35 | 36 | /// 37 | /// Gets or sets the list (data elements) in the section. 38 | /// 39 | public IList List 40 | { 41 | get; 42 | set; 43 | } 44 | 45 | internal override void EncodeValue(ByteBuffer buffer) 46 | { 47 | Encoder.WriteList(buffer, this.List, true); 48 | } 49 | 50 | internal override void DecodeValue(ByteBuffer buffer) 51 | { 52 | this.List = Encoder.ReadList(buffer, Encoder.ReadFormatCode(buffer)); 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /test/PerfTest/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | using System.Reflection; 18 | using System.Runtime.CompilerServices; 19 | using System.Runtime.InteropServices; 20 | 21 | // General Information about an assembly is controlled through the following 22 | // set of attributes. Change these attribute values to modify the information 23 | // associated with an assembly. 24 | [assembly: AssemblyTitle("PerfTest")] 25 | [assembly: AssemblyDescription("")] 26 | [assembly: AssemblyConfiguration("")] 27 | [assembly: AssemblyCompany("")] 28 | [assembly: AssemblyProduct("PerfTest")] 29 | [assembly: AssemblyCopyright("Copyright © 2014")] 30 | [assembly: AssemblyTrademark("")] 31 | [assembly: AssemblyCulture("")] 32 | 33 | // Version information for an assembly consists of the following four values: 34 | // 35 | // Major Version 36 | // Minor Version 37 | // Build Number 38 | // Revision 39 | // 40 | // You can specify all the values or you can default the Build and Revision Numbers 41 | // by using the '*' as shown below: 42 | // [assembly: AssemblyVersion("1.0.*")] 43 | [assembly: AssemblyVersion("1.0.0.0")] 44 | [assembly: AssemblyFileVersion("1.0.0.0")] 45 | -------------------------------------------------------------------------------- /test/LongHaulTest/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | using System.Reflection; 18 | using System.Runtime.CompilerServices; 19 | using System.Runtime.InteropServices; 20 | 21 | // General Information about an assembly is controlled through the following 22 | // set of attributes. Change these attribute values to modify the information 23 | // associated with an assembly. 24 | [assembly: AssemblyTitle("PerfTest")] 25 | [assembly: AssemblyDescription("")] 26 | [assembly: AssemblyConfiguration("")] 27 | [assembly: AssemblyCompany("")] 28 | [assembly: AssemblyProduct("PerfTest")] 29 | [assembly: AssemblyCopyright("Copyright © 2014")] 30 | [assembly: AssemblyTrademark("")] 31 | [assembly: AssemblyCulture("")] 32 | 33 | // Version information for an assembly consists of the following four values: 34 | // 35 | // Major Version 36 | // Minor Version 37 | // Build Number 38 | // Revision 39 | // 40 | // You can specify all the values or you can default the Build and Revision Numbers 41 | // by using the '*' as shown below: 42 | // [assembly: AssemblyVersion("1.0.*")] 43 | [assembly: AssemblyVersion("1.0.0.0")] 44 | [assembly: AssemblyFileVersion("1.0.0.0")] 45 | -------------------------------------------------------------------------------- /Examples/ServiceBus/ServiceBus.EventHub.nanoFramework/Program.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | using Amqp; 19 | using nanoFramework.Networking; 20 | using ServiceBus.Scenarios; 21 | using System; 22 | using System.Diagnostics; 23 | using AmqpTrace = Amqp.Trace; 24 | 25 | namespace ServiceBus.EventHub 26 | { 27 | public class Program 28 | { 29 | public static void Main() 30 | { 31 | // setup and connect network 32 | NetworkHelpers.SetupAndConnectNetwork(true); 33 | 34 | AmqpTrace.TraceLevel = TraceLevel.Information; 35 | AmqpTrace.TraceListener = (l, f, a) => Debug.WriteLine(Fx.Format(f, a)); 36 | Connection.DisableServerCertValidation = true; 37 | 38 | // wait for network and valid system date time 39 | NetworkHelpers.IpAddressAvailable.WaitOne(); 40 | NetworkHelpers.DateTimeAvailable.WaitOne(); 41 | 42 | try 43 | { 44 | new EventHubsExample().Run(); 45 | } 46 | catch (Exception e) 47 | { 48 | AmqpTrace.WriteLine(TraceLevel.Error, e.ToString()); 49 | } 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /src/Serialization/AmqpMemberAttribute.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Serialization 19 | { 20 | using System; 21 | 22 | /// 23 | /// Specifies that the member is part of an AMQP serializable type. 24 | /// 25 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, 26 | AllowMultiple = false, Inherited = true)] 27 | public sealed class AmqpMemberAttribute : Attribute 28 | { 29 | int? order; 30 | 31 | /// 32 | /// Gets or sets the field name of the member. 33 | /// 34 | public string Name 35 | { 36 | get; 37 | set; 38 | } 39 | 40 | /// 41 | /// Gets or sets the order of the member in the list when encoding type is 42 | /// set to list. 43 | /// 44 | public int Order 45 | { 46 | get { return this.order.HasValue ? this.order.Value : 0; } 47 | 48 | set { this.order = value; } 49 | } 50 | 51 | internal int? InternalOrder 52 | { 53 | get { return this.order; } 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Examples/Device/Device.Controller/Properties/WMAppManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Assets\ApplicationIcon.png 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | Assets\Tiles\FlipCycleTileSmall.png 20 | 0 21 | Assets\Tiles\FlipCycleTileMedium.png 22 | iHome 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /nuspec/AMQPNetLite.WebSockets.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | AMQPNetLite.WebSockets 5 | AMQP.Net Lite WebSockets Client on .Net Core 6 | 0.0.0 7 | xinchen 8 | Apache-2.0 9 | https://github.com/Azure/amqpnetlite 10 | 11 | false 12 | This package provides the WebSockets client transport of AMQP.Net Lite for netstandard. 13 | docs\README.md 14 | Copyright 2014 15 | AMQP coreclr netstandard WebSockets 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /nuspec/AMQPNetLite.NetMF.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | AMQPNetLite.NetMF 5 | AMQP.Net Lite for NetMF 6 | 0.0.0 7 | xinchen 8 | Apache-2.0 9 | https://github.com/Azure/amqpnetlite 10 | 11 | false 12 | 13 | This is a lightweight AMQP 1.0 library for .Net Micro Framework (netmf). A more compact version 14 | for NETMF is available in the AmqpNetMicro package. 15 | 16 | docs\README.md 17 | Copyright 2014 18 | AMQP net netmf 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/Types/Descriptor.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Types 19 | { 20 | /// 21 | /// The descriptor of a described type. 22 | /// 23 | public sealed class Descriptor 24 | { 25 | /// 26 | /// The descriptor name. 27 | /// 28 | public readonly string Name; 29 | 30 | /// 31 | /// The descriptor code. 32 | /// 33 | public readonly ulong Code; 34 | 35 | /// 36 | /// Initializes a descriptor object. 37 | /// 38 | /// The descriptor code. 39 | /// The descriptor name. 40 | public Descriptor(ulong code, string name) 41 | { 42 | this.Code = code; 43 | this.Name = name; 44 | } 45 | 46 | #if TRACE 47 | /// 48 | /// Returns a string that represents the current descriptor object. 49 | /// 50 | /// 51 | public override string ToString() 52 | { 53 | return this.Name ?? this.Code.ToString(); 54 | } 55 | #endif 56 | } 57 | } -------------------------------------------------------------------------------- /Examples/Device/Device.Controller/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | using System.Reflection; 19 | using System.Runtime.CompilerServices; 20 | using System.Runtime.InteropServices; 21 | 22 | // General Information about an assembly is controlled through the following 23 | // set of attributes. Change these attribute values to modify the information 24 | // associated with an assembly. 25 | [assembly: AssemblyTitle("Device.Controller")] 26 | [assembly: AssemblyDescription("")] 27 | [assembly: AssemblyConfiguration("")] 28 | [assembly: AssemblyCompany("")] 29 | [assembly: AssemblyProduct("Device.Controller")] 30 | [assembly: AssemblyCopyright("Copyright © 2015")] 31 | [assembly: AssemblyTrademark("")] 32 | [assembly: AssemblyCulture("")] 33 | 34 | // Version information for an assembly consists of the following four values: 35 | // 36 | // Major Version 37 | // Minor Version 38 | // Build Number 39 | // Revision 40 | // 41 | // You can specify all the values or you can default the Build and Revision Numbers 42 | // by using the '*' as shown below: 43 | // [assembly: AssemblyVersion("1.0.*")] 44 | [assembly: AssemblyVersion("1.0.0.0")] 45 | [assembly: AssemblyFileVersion("1.0.0.0")] 46 | [assembly: ComVisible(false)] -------------------------------------------------------------------------------- /src/Framing/Released.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Framing 19 | { 20 | using Amqp.Types; 21 | 22 | /// 23 | /// The released outcome is a terminal delivery state. 24 | /// 25 | public sealed class Released : Outcome 26 | { 27 | /// 28 | /// Initializes a released object. 29 | /// 30 | public Released() 31 | : base(Codec.Released, 0) 32 | { 33 | } 34 | 35 | internal override void WriteField(ByteBuffer buffer, int index) 36 | { 37 | Fx.Assert(false, "Invalid field index"); 38 | } 39 | 40 | internal override void ReadField(ByteBuffer buffer, int index, byte formatCode) 41 | { 42 | Fx.Assert(false, "Invalid field index"); 43 | } 44 | 45 | #if TRACE 46 | /// 47 | /// Returns a string that represents the current released object. 48 | /// 49 | /// 50 | public override string ToString() 51 | { 52 | return this.GetDebugString( 53 | "released", 54 | new object[0], 55 | new object[0]); 56 | } 57 | #endif 58 | } 59 | } -------------------------------------------------------------------------------- /src/Listener/FlowContext.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Listener 19 | { 20 | using Amqp.Types; 21 | 22 | /// 23 | /// Provides the context to a link endpoint to process a received flow. 24 | /// 25 | public class FlowContext 26 | { 27 | internal FlowContext(ListenerLink link, int messages, Fields properties) 28 | { 29 | this.Link = link; 30 | this.Messages = messages; 31 | this.Properties = properties; 32 | } 33 | 34 | /// 35 | /// Gets the link associated with the context. 36 | /// 37 | public ListenerLink Link 38 | { 39 | get; 40 | private set; 41 | } 42 | 43 | /// 44 | /// Gets the number of messages allowed to send by the peer. 45 | /// 46 | public int Messages 47 | { 48 | get; 49 | private set; 50 | } 51 | 52 | /// 53 | /// Gets the properties associated with the flow performative. 54 | /// 55 | public Fields Properties 56 | { 57 | get; 58 | private set; 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/Listener/MessageContext.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Listener 19 | { 20 | using Amqp.Framing; 21 | 22 | /// 23 | /// Provides the context to a message processor to process the received message. 24 | /// 25 | public class MessageContext : Context 26 | { 27 | internal MessageContext(ListenerLink link, Message message) 28 | : base(link, message) 29 | { 30 | this.DeliveryState = message.Delivery?.State; 31 | } 32 | 33 | /// 34 | /// Gets the delivery state associated with the message. 35 | /// 36 | public DeliveryState DeliveryState 37 | { 38 | get; 39 | private set; 40 | } 41 | 42 | /// 43 | /// Accepts the message. 44 | /// 45 | public void Complete() 46 | { 47 | this.Dispose(Context.Accepted); 48 | } 49 | 50 | /// 51 | /// Rejects the message. 52 | /// 53 | /// 54 | public void Complete(Error error) 55 | { 56 | this.Dispose(new Rejected() { Error = error }); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Examples/ServiceBus/ServiceBus.Listener/Program.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Test.ServiceBusListener 19 | { 20 | using System; 21 | 22 | class Program 23 | { 24 | static void Usage() 25 | { 26 | Console.WriteLine("TestServiceBusListener address"); 27 | Console.WriteLine(" url=amqp|amqps://host[:port]"); 28 | } 29 | 30 | static void Main(string[] args) 31 | { 32 | if (args.Length < 1) 33 | { 34 | Usage(); 35 | } 36 | else 37 | { 38 | try 39 | { 40 | Run(args); 41 | } 42 | catch (Exception exception) 43 | { 44 | Console.WriteLine(exception.ToString()); 45 | } 46 | } 47 | } 48 | 49 | static void Run(string[] args) 50 | { 51 | var listener = new TestServiceBusListener(new Uri(args[0])); 52 | listener.Open(); 53 | 54 | Console.WriteLine("Listener started. Press the enter key to exit..."); 55 | Console.ReadLine(); 56 | 57 | listener.Close(); 58 | Console.WriteLine("Broker stopped"); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/Framing/Accepted.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Amqp.Framing 19 | { 20 | using Amqp.Types; 21 | 22 | /// 23 | /// The accepted outcome. 24 | /// 25 | public sealed class Accepted : Outcome 26 | { 27 | /// 28 | /// Initializes an accepted outcome. 29 | /// 30 | public Accepted() 31 | : base(Codec.Accepted, 0) 32 | { 33 | } 34 | 35 | internal override void WriteField(ByteBuffer buffer, int index) 36 | { 37 | Fx.Assert(false, "Invalid field index"); 38 | } 39 | 40 | internal override void ReadField(ByteBuffer buffer, int index, byte formatCode) 41 | { 42 | Fx.Assert(false, "Invalid field index"); 43 | } 44 | 45 | /// 46 | /// Returns a string that represents the current accepted outcome. 47 | /// 48 | /// 49 | public override string ToString() 50 | { 51 | #if TRACE 52 | return this.GetDebugString( 53 | "accepted", 54 | new object[0], 55 | new object[0]); 56 | #else 57 | return base.ToString(); 58 | #endif 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /test/Common/TestSetup.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 3 | // file except in compliance with the License. You may obtain a copy of the License at 4 | // http://www.apache.org/licenses/LICENSE-2.0 5 | // 6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 7 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 8 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 9 | // NON-INFRINGEMENT. 10 | // 11 | // See the Apache Version 2.0 License for specific language governing permissions and 12 | // limitations under the License. 13 | // ------------------------------------------------------------------------------------ 14 | 15 | using System; 16 | using System.Diagnostics; 17 | using Microsoft.VisualStudio.TestTools.UnitTesting; 18 | 19 | namespace Test.Amqp 20 | { 21 | #if (NETFX || DOTNET) && !BUILD_SCRIPT 22 | [TestClass] 23 | public class TestSetup 24 | { 25 | static Listener.IContainer.TestAmqpBroker broker; 26 | 27 | [AssemblyInitialize] 28 | public static void Initialize(TestContext context) 29 | { 30 | string address = Environment.GetEnvironmentVariable(TestTarget.envVarName); 31 | if (address == null) 32 | { 33 | if (Process.GetProcessesByName("TestAmqpBroker").Length == 0) 34 | { 35 | string[] addresses = new[] 36 | { 37 | "amqp://localhost:5672", 38 | "amqps://localhost:5671", 39 | #if NETFX 40 | "ws://localhost:18080" 41 | #endif 42 | }; 43 | broker = new Listener.IContainer.TestAmqpBroker(addresses, "guest:guest", "localhost", null); 44 | broker.Start(); 45 | } 46 | } 47 | } 48 | 49 | [AssemblyCleanup()] 50 | public static void AssemblyCleanup() 51 | { 52 | broker?.Stop(); 53 | } 54 | } 55 | #endif 56 | } -------------------------------------------------------------------------------- /test/Common/Types/Student.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------------ 2 | // Copyright (c) Microsoft Corporation 3 | // All rights reserved. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the License at 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 11 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR 12 | // NON-INFRINGEMENT. 13 | // 14 | // See the Apache Version 2.0 License for specific language governing permissions and 15 | // limitations under the License. 16 | // ------------------------------------------------------------------------------------ 17 | 18 | namespace Test.Amqp 19 | { 20 | using System.Collections.Generic; 21 | using global::Amqp.Serialization; 22 | using global::Amqp.Types; 23 | 24 | [AmqpContract(Name = "test.amqp:student", Code = 0x0000123400000001)] 25 | class Student : Person 26 | { 27 | public Student() : base(null) { } 28 | 29 | public Student(string name) 30 | : base(name) 31 | { 32 | } 33 | 34 | [AmqpMember(Name = "address", Order = 4)] 35 | public StreetAddress Address; 36 | 37 | [AmqpMember(Name = "grades", Order = 10)] 38 | public List Grades { get; set; } 39 | 40 | [AmqpMember(Name = "gpa", Order = 11)] 41 | public Decimal Gpa { get; set; } 42 | 43 | [OnSerializing] 44 | void OnSerializing() 45 | { 46 | this.Version++; 47 | } 48 | 49 | [OnSerialized] 50 | void OnSerialized() 51 | { 52 | this.Version++; 53 | } 54 | 55 | [OnDeserializing] 56 | void OnDeserializing() 57 | { 58 | this.Version++; 59 | } 60 | 61 | [OnDeserialized] 62 | void OnDeserialized() 63 | { 64 | this.Version++; 65 | } 66 | } 67 | } 68 | --------------------------------------------------------------------------------