summaryrefslogtreecommitdiff
path: root/doc/protocol.md
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2020-02-28 11:51:43 +0000
committerIan C <ianc@noddybox.co.uk>2020-02-28 11:51:43 +0000
commit4f52974cd5bd5a5a749a90408f4ccf7fe7c8fc1c (patch)
tree0b98cce4fff9c347f04707f1eb1b57dda05a5ae1 /doc/protocol.md
parent00f82a4ab7b4f57d243c8fec06119f2f2c226ff4 (diff)
Added initial protocol documentation.
Diffstat (limited to 'doc/protocol.md')
-rw-r--r--doc/protocol.md89
1 files changed, 89 insertions, 0 deletions
diff --git a/doc/protocol.md b/doc/protocol.md
new file mode 100644
index 0000000..b804df7
--- /dev/null
+++ b/doc/protocol.md
@@ -0,0 +1,89 @@
+Next File Transfer Protocol
+===========================
+
+Introduction
+------------
+
+Next File Transfer uses a simple protocol where a single character defines
+a message type.
+
+The following are standard compents of a message:
+
+> <NNNNN> 5 ASCII digits making up a zero-padded number.
+> <N bytes> A stream of N bytes.
+
+
+Put File
+--------
+
+The format of the message from the client is:
+
+> A Put file command
+> <NNNNN> Length of filename
+> <N bytes> The filename
+> <NNNNN> Length of the data for the file.
+> <N bytes> The data.
+
+The server responds with either:
+
+> OK The command completed OK
+
+or:
+
+> !E There was an error writing the file.
+
+
+Get File
+--------
+
+The format of the message from the client is:
+
+> B Put file command
+> <NNNNN> Length of filename
+> <N bytes> The filename
+
+The server responds with either:
+
+> OK The command completed OK. The file contents will follow.
+> <NNNNN> The length of the following data.
+> <N bytes> The data frin from the file.
+
+or:
+
+> !E There was an error reading the file.
+
+
+Change Directory
+----------------
+
+The format of the message from the client is:
+
+> C Change directory command
+> NNNNN Length of pathname
+> <N bytes> The pathname
+
+The server responds with either:
+
+> OK The command completed OK
+
+or:
+
+> !E There was an error changing to the directory
+
+
+Create Directory
+----------------
+
+The format of the message from the client is:
+
+> D Create directory command
+> NNNNN Length of pathname
+> <N bytes> The pathname
+
+The server responds with either:
+
+> OK The command completed OK
+
+or:
+
+> !E There was an error creating the directory