forked from zeromq/gyre
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zre_msg.bnf
84 lines (63 loc) · 3.62 KB
/
zre_msg.bnf
1
2
3
4
5
6
7
8
9
10
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
The following ABNF grammar defines the work with ZRE messages:
zre = greeting *traffic
greeting = hello
traffic = whisper / shout / join / leave / ping / ping-ok
; Greet a peer so it can connect back to us
HELLO = signature %d1 version sequence endpoint groups status name headers
signature = %xAA %xA1 ; two octets
version = number-1 ; Version number (2)
sequence = number-2 ; Cyclic sequence number
endpoint = string ; Sender connect endpoint
groups = strings ; List of groups sender is in
status = number-1 ; Sender groups status value
name = string ; Sender public name
headers = hash ; Sender header properties
; Send a multi-part message to a peer
WHISPER = signature %d2 version sequence content
version = number-1 ; Version number (2)
sequence = number-2 ; Cyclic sequence number
content = msg ; Wrapped message content
; Send a multi-part message to a group
SHOUT = signature %d3 version sequence group content
version = number-1 ; Version number (2)
sequence = number-2 ; Cyclic sequence number
group = string ; Group to send to
content = msg ; Wrapped message content
; Join a group
JOIN = signature %d4 version sequence group status
version = number-1 ; Version number (2)
sequence = number-2 ; Cyclic sequence number
group = string ; Name of group
status = number-1 ; Sender groups status value
; Leave a group
LEAVE = signature %d5 version sequence group status
version = number-1 ; Version number (2)
sequence = number-2 ; Cyclic sequence number
group = string ; Name of group
status = number-1 ; Sender groups status value
; Ping a peer that has gone silent
PING = signature %d6 version sequence
version = number-1 ; Version number (2)
sequence = number-2 ; Cyclic sequence number
; Reply to a peer's ping
PING-OK = signature %d7 version sequence
version = number-1 ; Version number (2)
sequence = number-2 ; Cyclic sequence number
; A list of string values
strings = strings-count *strings-value
strings-count = number-4
strings-value = longstr
; A list of name/value pairs
hash = hash-count *( hash-name hash-value )
hash-count = number-4
hash-value = longstr
hash-name = string
; A msg is zero or more distinct frames
msg = *frame
; Strings are always length + text contents
string = number-1 *VCHAR
longstr = number-4 *VCHAR
; Numbers are unsigned integers in network byte order
number-1 = 1OCTET
number-2 = 2OCTET
number-4 = 4OCTET