You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.rst
+16-5Lines changed: 16 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -100,6 +100,8 @@ must end with `/` when provided as a full path.
100
100
101
101
All numbers are unsigned.
102
102
103
+
All values are aligned with respect to the start of the packet.
104
+
103
105
Status bytes are `0x01` for OK and `0x02` for error. Other values for error may be used for specific commands.
104
106
105
107
`0x10` - Read a file
@@ -110,14 +112,16 @@ Given a full path, returns the full contents of the file.
110
112
The header is four fixed entries and a variable length path:
111
113
112
114
* Command: Single byte. Always `0x10`.
115
+
* 1 Byte reserved for padding.
116
+
* Path length: 16-bit number encoding the encoded length of the path string.
113
117
* Chunk offset: 32-bit number encoding the offset into the file to start the first chunk.
114
118
* Chunk size: 32-bit number encoding the amount of data that the client can handle in the first reply.
115
-
* Path length: 16-bit number encoding the encoded length of the path string.
116
119
* Path: UTF-8 encoded string that is *not* null terminated. (We send the length instead.)
117
120
118
121
The server will respond with:
119
122
* Command: Single byte. Always `0x11`.
120
123
* Status: Single byte.
124
+
* 2 Bytes reserved for padding.
121
125
* Chunk offset: 32-bit number encoding the offset into the file of this chunk.
122
126
* Total length: 32-bit number encoding the total file length.
123
127
* Chunk length: 32-bit number encoding the length of the read data up to the chunk size provided in the header.
@@ -126,6 +130,7 @@ The server will respond with:
126
130
If the chunk length is smaller than the total length, then the client will request more data by sending:
127
131
* Command: Single byte. Always `0x12`.
128
132
* Status: Single byte. Always OK for now.
133
+
* 2 Bytes reserved for padding.
129
134
* Chunk offset: 32-bit number encoding the offset into the file to start the next chunk.
130
135
* Chunk size: 32-bit number encoding the number of bytes to read. May be different than the original size. Does not need to be limited by the total size.
131
136
@@ -141,20 +146,23 @@ Offset larger than the existing file size will introduce zeros into the gap.
141
146
The header is four fixed entries and a variable length path:
142
147
143
148
* Command: Single byte. Always `0x20`.
149
+
* 1 Byte reserved for padding.
150
+
* Path length: 16-bit number encoding the encoded length of the path string.
144
151
* Offset: 32-bit number encoding the starting offset to write.
145
152
* Total size: 32-bit number encoding the total length of the file contents.
146
-
* Path length: 16-bit number encoding the encoded length of the path string.
147
153
* Path: UTF-8 encoded string that is *not* null terminated. (We send the length instead.)
148
154
149
155
The server will repeatedly respond until the total length has been transferred with:
150
156
* Command: Single byte. Always `0x21`.
151
157
* Status: Single byte. `0x01` if OK. `0x02` if any parent directory is missing or a file.
158
+
* 2 Bytes reserved for padding.
152
159
* Offset: 32-bit number encoding the starting offset to write. (Should match the offset from the previous 0x20 or 0x22 message)
153
160
* Free space: 32-bit number encoding the amount of data the client can send.
154
161
155
162
The client will repeatedly respond until the total length has been transferred with:
156
163
* Command: Single byte. Always `0x22`.
157
164
* Status: Single byte. Always `0x01` for OK.
165
+
* 2 Bytes reserved for padding.
158
166
* Offset: 32-bit number encoding the offset to write.
159
167
* Data size: 32-bit number encoding the amount of data the client is sending.
160
168
* Data
@@ -170,6 +178,7 @@ Deletes the file or directory at the given full path. Directories must be empty
170
178
The header is two fixed entries and a variable length path:
171
179
172
180
* Command: Single byte. Always `0x30`.
181
+
* 1 Byte reserved for padding.
173
182
* Path length: 16-bit number encoding the encoded length of the path string.
174
183
* Path: UTF-8 encoded string that is *not* null terminated. (We send the length instead.)
175
184
@@ -185,6 +194,7 @@ Creates a new directory at the given full path. If a parent directory does not e
185
194
The header is two fixed entries and a variable length path:
186
195
187
196
* Command: Single byte. Always `0x40`.
197
+
* 1 Byte reserved for padding.
188
198
* Path length: 16-bit number encoding the encoded length of the path string.
189
199
* Path: UTF-8 encoded string that is *not* null terminated. (We send the length instead.)
190
200
@@ -200,19 +210,20 @@ Lists all of the contents in a directory given a full path. Returned paths are *
200
210
The header is two fixed entries and a variable length path:
201
211
202
212
* Command: Single byte. Always `0x50`.
213
+
* 1 Byte reserved for padding.
203
214
* Path length: 16-bit number encoding the encoded length of the path string.
204
215
* Path: UTF-8 encoded string that is *not* null terminated. (We send the length instead.)
205
216
206
217
The server will reply with n+1 entries for a directory with n files:
207
218
* Command: Single byte. Always `0x51`.
208
219
* Status: Single byte. `0x01` if the directory exists or `0x02` if it doesn't.
220
+
* Path length: 16-bit number encoding the encoded length of the path string.
209
221
* Entry number: 32-bit number encoding the entry number.
210
222
* Total entries: 32-bit number encoding the total number of entries.
211
223
* Flags: 32-bit number encoding data about the entries.
212
-
* Bit 0: Set when the entry is a directory
213
-
* Bits 1-7: Reserved
224
+
- Bit 0: Set when the entry is a directory
225
+
- Bits 1-7: Reserved
214
226
* File size: 32-bit number encoding the size of the file. Ignore for directories. Value may change.
215
-
* Path length: 16-bit number encoding the encoded length of the path string.
216
227
* Path: UTF-8 encoded string that is *not* null terminated. (We send the length instead.) These paths are relative so they won't contain `/` at all.
217
228
218
229
The transaction is complete when the final entry is sent from the server. It will have entry number == total entries and zeros for flags, file size and path length.
0 commit comments