-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require "../spec_helper" | ||
require "../../src/amq/protocol.cr" | ||
|
||
describe AMQ::Protocol do | ||
it "defines AMQP 1.0 header" do | ||
AMQ::Protocol::PROTOCOL_START_1_0_0.to_slice.to_a.should eq "AMQP\x00\x01\x00\x00".bytes | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module AMQ | ||
module Protocol | ||
module V1 | ||
abstract struct Frame | ||
getter bytesize : UInt32 | ||
getter doff : UInt8 | ||
getter type : UInt8 | ||
end | ||
|
||
abstract struct AMQP < Frame | ||
TYPE = 0_u8 | ||
|
||
getter channel : UInt16 | ||
|
||
def type : UInt8 | ||
TYPE | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require "./frames" | ||
require "./types" | ||
|
||
module AMQ | ||
module Protocol | ||
module V1 | ||
struct Open < AMQP | ||
getter containerId : String | ||
getter hostname : String | ||
getter maxFrameSize : UInt | ||
getter channelMax : UShort | ||
getter maxIdleTimeout : Milliseconds | ||
getter outGoingLocales : Array(IETFLanguageTag) | ||
getter incomingGoingLocales : Array(IETFLanguageTag) | ||
getter offeredCapabilities : Array(Symbol) | ||
getter desiredCapabilities : Array(Symbol) | ||
getter properties : Fields | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
alias UInt = UInt32 | ||
alias UShort = UInt16 | ||
alias Milliseconds = UInt | ||
|
||
struct Symbol | ||
# TODO | ||
end | ||
|
||
alias IETFLanguageTag = Symbol | ||
|
||
alias Value = UInt | UShort | Milliseconds | Symbol | Array(Value) | | ||
IETFLanguageTag | Map(Symbol, Value) | ||
|
||
# A polymorphic mapping from distinct keys to values | ||
struct Map(K, V) | ||
# TODO | ||
end | ||
|
||
alias Fields = Map(Symbol, Value) | ||
|
||
# A sequence of polymorphic values | ||
alias List = Array(Value) |