This spec suggests a modern, extensible alternative to Zmodem which supports directory transfers and is transparent to both Unicode processing and 7-bit serial connections. All data is incapsulated inside OSC control sequences, which are transparent to terminals and terminal emulators, and won't corrupt terminal state if a connection is lost or one of the sides doesn't understand the protocol. Unlike Zmodem, it also allows normal terminal I/O to continue while a
Once both sides have announced their presence, any side can offer an
A single
\x1b]1337;SHIFT;
\x07
Provides a communication stream that is transparent to the terminal.
Transport layer encodes/decodes
[packet prefix] [base64-encoded contents] [packet suffix]
Encodes structured protocol
message Message {
oneof content {
Init init = 1;
Disconnect disconnect = 2;
ReceiveRequest receiveRequest = 3;
SendRequest sendRequest = 4;
AcceptTransfer acceptTransfer = 5;
RejectTransfer rejectTransfer = 6;
OpenFile openFile = 7;
FileOpened fileOpened = 8;
Chunk chunk = 9;
CloseFile closeFile = 10;
CloseTransfer closeTransfer = 11;
}
}
message Init {
uint32 version = 1;
repeated string features = 2;
}
Versioncurrently 1.
Featurescurrently unused. //TODO
message FileInfo {
string name = 1;
uint64 size = 2;
uint32 mode = 3;
}
modePOSIX file mode, the
message ReceiveRequest {
bool allowDirectories = 1;
}
message SendRequest {
FileInfo fileInfo = 1;
}
message AcceptTransfer { }
message RejectTransfer { }
message OpenFile {
FileInfo fileInfo = 1;
}
fileInfo.namefor file transfers, only
.
is allowed. For directory transfers, it's a path relative to the directory being transferred.
message FileOpened {
uint64 continueFrom = 1;
}
continueFromif not zero, the sender would like to start
message Chunk {
uint64 offset = 1;
bytes data = 2;
}
.
message CloseFile { }
message CloseTransfer { }
message Disconnect { }
The protocol's behaviour is defined as a finite state machine with the following well-defined states and transitions between these states.
The protocol's behaviour is defined as a finite state machine with the following states:
The possible state transitions are:
© 2021 SHIFT contributors
All Software contained in this document ("Software") is protected by copyright and is being made available under the "BSD License", included below. This Software may be subject to third party rights (rights from parties other than Ecma International), including patent rights, and no licenses under such third party rights are granted under this license even if the third party concerned is a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT MATTERS AVAILABLE AT https://ecma-international.org/memento/codeofconduct.htm FOR INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO IMPLEMENT ECMA INTERNATIONAL STANDARDS.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE ECMA INTERNATIONAL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ECMA INTERNATIONAL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.