This repository has been archived by the owner on Jan 28, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathprotocol.txt
262 lines (240 loc) · 6.86 KB
/
protocol.txt
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
History Gluon Server-client protocol specification
Date: 2012/11/11
Version: 0.8.0
*** Basics rules ***
Endian: Little
[<Number>] means Length in Byte (decimal)
=========================================
COMMAND: Connect
=========================================
[ 4] Magic Code
0x48, 0x47, 0x4c, 0x00 ('H','G','L','\0')
[ 2] Length of database name
[ v] Database name
valid characters: A-z, 0-9, .(dot), _(underscore), -(hyphen), @(at),
and /(slash).
maximum length: 1024
-----------------------------------------
REPLY: Add Data
-----------------------------------------
[ 4] Magic Code
0x48, 0x47, 0x4c, 0x00 ('H','G','L','\0')
[ 4] Result
=========================================
COMMAND: Add Data
=========================================
[ 4] Packet length (not including this field)
When 'Data type' is String and Blob, this doesn't include the size of
String body and Blob body respectively.
[ 4] Command type
100: Add Data
[ 2] Data type
00: Float (double precision: 64bit)
01: Integer (64bit)
02: String
03: Blob (binary large object)
[ 8] ID
[ 4] Time: second
[ 4] Time: nano-second
--- Data Type: 00 (Float) ---
[ 8] Float Data IEEE 754 (64bit)
--- Data type: 01 (Integer) ---
[ 8] Integer Data
--- Data type: 02 (String) ---
[ 4] String length (The maximum: 0x7ffffff)
[ v] String body (Null terminator is NOT needed)
--- Data type: 03 (Blob) ---
[ 8] Blob length (The maximum: 0x7fffffff ffffffff)
[ v] Blobl body
-----------------------------------------
REPLY: Add Data
-----------------------------------------
[ 4] Packet length (not including this)
[ 2] Reply type
100: reply: Add Data
[ 4] Result
=========================================
COMMAND PKT: Query Data
=========================================
[ 4] Packet length (not including this)
[ 2] Command type
200: Query Data
[ 8] ID
[ 4] Time: second
[ 4] Time: nano-second
[ 2] Query type
0: only match
1: less data when not found
2: greater data when not found
-----------------------------------------
REPLY: Query Data
-----------------------------------------
[ 4] Packet length (not including this and up to 'Data type')
[ 2] Reply type
200: reply: Query Data
[ 4] Result
<< Body part: If Found is 0, this part is omitted>>
[ 8] ID
[ 4] Time: second
[ 4] Time: nano-second
[ 2] Data type
--- Data Type: 00 (Float) ---
[ 8] Float Data IEEE 754 (64bit)
--- Data type: 01 (Integer) ---
[ 8] Integer Data
--- Data type: 02 (String) ---
[ 4] String length (The maximum: 0x7ffffff)
[ v] String body (Null terminator is NOT needed)
--- Data type: 03 (Blob) ---
[ 8] Blob length (The maximum: 0x7fffffff ffffffff)
[ v] Blobl body
<< End of Body part >>
=========================================
COMMAND PKT: Range Query
=========================================
[ 4] Packet length (not including this field)
[ 4] Command type
300: Range Query
[ 8] ID
[ 4] Start Time: second
[ 4] Start Time: nano-second
[ 4] End Time: second
[ 4] End Time: nano-second
Data with the Start Time is returned.
Data with the End Time is Not returned.
[ 8] The number of the maximum entries
0: No limit
[ 2] Sort order request
0: ascending
1: descending
2: not sorted
-----------------------------------------
REPLY: Range Query
-----------------------------------------
[ 4] Packet length (not including this and up to 'Sort order')
[ 2] Reply type
300: reply: Range Query
[ 4] Result
[ 8] The number of entries
[ 2] Sort order
0: ascending
1: descending
2: not sorted
<< Body part: Repeated the the number of entries times>>
%%% The same as the body of 'REPLY: Query Data' %%%
<< End of Body part >>
=========================================
COMMAND PKT: Query All
=========================================
[ 4] Packet length (not including this field)
[ 4] Command type
310: Query All
-----------------------------------------
REPLY: Query All
-----------------------------------------
[ 4] Packet length (not including this and up to 'Reply type')
[ 2] Reply type
310: reply: Query All
<< Body part: Repeated the the number of entries times>>
%%% The same as the body of 'REPLY: Query Data' %%%
<< End of Body part >>
[ 8] 0
[ 4] 0
[ 4] 0
[ 2] 0xf000
[ 4] Result
=========================================
COMMAND PKT: Get Miminum Time
=========================================
[ 4] Packet length (not including this)
[ 2] Command type
400: Get Mininum Time
[ 8] Item ID
-----------------------------------------
REPLY: Get Minimum Time
-----------------------------------------
[ 4] Packet length (not including this)
[ 2] Reply Type
400: Get Mininum Time
[ 4] Result
[ 4] Minimum time: second
[ 4] Minimum time: nano-second
=========================================
COMMAND PKT: Get Statistics
=========================================
[ 4] Packet length (not including this)
[ 2] Command type
500: Get Statistics
[ 8] ID
[ 4] Start Time: second
[ 4] Start Time: nano-second
[ 4] End Time: second
[ 4] End Time: nano-second
Data with the Start Time is used.
Data with the End Time is Not used.
NOTE: Data with ID must be Float or Integer type.
-----------------------------------------
REPLY PKT: Get Statistics
-----------------------------------------
[ 4] Packet length (not including this)
[ 2] Reply type
500: reply: Get Statistics
[ 4] Result
[ 8] ID
[ 8] Count: Interger (64bit)
[ 8] Minimum: Float (IEEE754)
[ 8] Maximum: Float (IEEE754)
[ 8] Sum: Float (IEEE754)
=========================================
COMMAND PKT: Delete Data
=========================================
[ 4] Packet length (not including this)
[ 2] Command type
600: Delete Data
[ 8] ID
[ 4] Time: second
[ 4] Time: nano-second
[ 2] Delete way:
0: Just matched data
1: Data with the time that is equal to or less than Time
2: Data with the time that is less than Time
3: Data with the time that is equal to or greater than Time
4: Data with the time that is greater than Time
-----------------------------------------
REPLY PKT: Delete Data
-----------------------------------------
[ 4] Packet length (not including this)
[ 2] Reply type
600: reply: Delete Data
[ 4] Result
[ 8] The count of the deleted data: Integer (64bit)
=========================================
COMMAND PKT: Delete All Data
=========================================
[ 4] Packet length (not including this)
[ 2] Command type
610: Delete All Data
-----------------------------------------
REPLY PKT: Delete All Data
-----------------------------------------
[ 4] Packet length (not including this)
[ 2] Reply type
610: reply: Delete All Data
[ 4] Result
==================================================
Result Code
==================================================
0: Success
1: Unknown error
2: Server Error
3: Unsupported protocol version
4: Not implemented
100: Authentification failed
101: Domain string is too long
102: Invalid characters in domain string
200: Packet short
201: Invalid data type
202: Invalid sort type
300: Entry exists
301: Not found
302: Too many enties