summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2020-02-28 13:06:16 +0000
committerIan C <ianc@noddybox.co.uk>2020-02-28 13:06:16 +0000
commit59b80401167bd0ade5895b18566eb589e78798db (patch)
tree513d148173aaddd8d8a4c4b38d17d2f84ba2f10a /doc
parent4f52974cd5bd5a5a749a90408f4ccf7fe7c8fc1c (diff)
Changed doc format to straight ASCII. Added some extra details.
Diffstat (limited to 'doc')
-rw-r--r--doc/protocol.md89
-rw-r--r--doc/protocol.txt163
2 files changed, 163 insertions, 89 deletions
diff --git a/doc/protocol.md b/doc/protocol.md
deleted file mode 100644
index b804df7..0000000
--- a/doc/protocol.md
+++ /dev/null
@@ -1,89 +0,0 @@
-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
diff --git a/doc/protocol.txt b/doc/protocol.txt
new file mode 100644
index 0000000..20378a0
--- /dev/null
+++ b/doc/protocol.txt
@@ -0,0 +1,163 @@
+Next File Transfer Protocol
+===========================
+
+Introduction
+------------
+
+Next File Transfer uses a simple protocol where a 2 character code 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:
+
+ +------------+------------------------------------------------------+
+ | PF | 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:
+
+ +------------+------------------------------------------------------+
+ | GF | Get 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> | Length of the following data |
+ +------------+------------------------------------------------------+
+ | <N bytes> | The data from from the file |
+ +------------+------------------------------------------------------+
+
+or:
+
+ +------------+------------------------------------------------------+
+ | !E | There was an error reading the file |
+ +------------+------------------------------------------------------+
+
+
+Change Directory
+----------------
+
+The format of the message from the client is:
+
+ +------------+------------------------------------------------------+
+ | CD | 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:
+
+ +------------+------------------------------------------------------+
+ | MD | 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 |
+ +------------+------------------------------------------------------+
+
+
+List Files
+----------
+
+The format of the message from the client is:
+
+ +------------+------------------------------------------------------+
+ | LS | List files command |
+ +------------+------------------------------------------------------+
+
+The server responds with either:
+
+ +------------+------------------------------------------------------+
+ | OK | The command completed OK |
+ +------------+------------------------------------------------------+
+ | <NNNNN> | The number of filenames |
+ +------------+------------------------------------------------------+
+ | <NNNNN> | Length of filename 1 |
+ +------------+------------------------------------------------------+
+ | <N bytes> | Filename 1 |
+ +------------+------------------------------------------------------+
+ ... above 2 fields repeated ...
+ +------------+------------------------------------------------------+
+ | <NNNNN> | Length of filename N |
+ +------------+------------------------------------------------------+
+ | <N bytes> | Filename N |
+ +------------+------------------------------------------------------+
+
+or:
+
+ +------------+------------------------------------------------------+
+ | !E | There was an error reading the directory |
+ +------------+------------------------------------------------------+