reposerve server half way done
[reposerve] / protocol
diff --git a/protocol b/protocol
new file mode 100644 (file)
index 0000000..4839b94
--- /dev/null
+++ b/protocol
@@ -0,0 +1,76 @@
+Reposerve protocol v1
+=====================
+
+Commands are variable-length strings ending with a newline character (10), with
+a maximum length of 256 characters, including the newline.
+
+Responses always start with a result line with either "OK", followed by a byte
+count of response data to follow, or an "ERR" followed by silence.
+
+All binary values in response data are in little-endian byte order (LSB-first).
+
+On connection establishment, the server sends a string of the form:
+    <server name>-<server version> protocol:<max protocol version supported>
+
+DOS filename mode
+-----------------
+Request: "dos"
+Description:
+When the client sends a dos request, the server enables DOS filename
+translation. Filename path components are automatically converted to DOS 8.3
+form when transmitted to the client. File lists transmitted by the client are
+translated back to the original names, capital letters for new untracked files
+are converted to lowercase, except for specific files such as "Makefile*",
+"GNUmakefile", "README*", and "COPYING*", otherwise for tracked files, the
+existing capitalization is maintained.
+
+File list
+---------
+Request: "flist"
+Response data: 
+
+    offset | size | description
+         0 |   4  | number of file entries (N)
+         4 |  32  | file entry 0
+      4+32 |  32  | file entry 1
+        ...
+    4+i*32 |  32  | file entry i
+         ...
+    4+N*32 |  ??  | file name table    
+
+    
+    File entry (32 bytes):
+    offset | size | description
+         0 |  16  | md5 checksum
+        16 |   4  | last modification timestamp
+        20 |   4  | file size
+        24 |   4  | name string offset (from the start of the name table)
+        28 |   4  | name string length
+
+Description:
+Provides a list of files managed by the repo server, with all the relevant
+metadata about each file.
+
+Push files
+----------
+Request: "push"
+Request data: Exactly the same as the "flist" response data, except that after
+each file name in the name table, the contents of the corresponding file are
+transmitted.
+
+Description:
+Although potentially every file can be sent using this request, the intent is to
+only push modified files according to either the modification timestamp or the
+checksum provided in the file list.
+
+Pull files
+----------
+Request: "pull"
+Request data: Exactly the same as the "flist" response data.
+Response data: Exactly the same as the "flist" response data, except that after
+the file name in the name table, the contents of the corresponding file are
+transmitted.
+
+Description:
+The server compares file checksums or modification timestamps in the request
+file list, and sends back only those files which are modified.