summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorAnton <anton@picapica>2019-02-14 21:48:17 +0400
committerAnton <anton@picapica>2019-02-14 21:48:17 +0400
commit88d28e8bf3c8780a5d7bc6747eac3762b4a769b4 (patch)
tree222cd1c1567c4970958e3a774a85aaa6696e2deb /doc
parent996e64d071cdbbd25cf96b3f594c53ca47cf029d (diff)
downloadpica-pica-88d28e8bf3c8780a5d7bc6747eac3762b4a769b4.tar.gz
pica-pica-88d28e8bf3c8780a5d7bc6747eac3762b4a769b4.zip
doc: updates, multilogin
Diffstat (limited to 'doc')
-rw-r--r--doc/proto-doc.txt61
-rwxr-xr-xdoc/proto.txt3
2 files changed, 61 insertions, 3 deletions
diff --git a/doc/proto-doc.txt b/doc/proto-doc.txt
index 3d7d853..cdfaec2 100644
--- a/doc/proto-doc.txt
+++ b/doc/proto-doc.txt
@@ -48,8 +48,10 @@ are always equal to each other.
Tail is a remaining part of the packet. Can be empty. Tail can have fixed
predefined length or in case of variable length packet it begins with 1 or 2
octet sequence that contains unsigned integer number which defines length in
-octets of remaining part of the tail not including lenght octets. Length field
+octets of remaining part of the tail not including length octets. Length field
is stored in little-endian format, least significant octet first.
+Whole packet length is limited to 65536 octets, so length field value is within
+0..65532 range.
Example:
@@ -58,3 +60,60 @@ Example:
[0x03 0x00] - tail length, 2 octets
[0xAA 0xBB 0xCC] payload, 3 octets
+
+C2N Messages.
+====================================================
+C2N Connection initialization request.
+Sent by client.
+ANON TLS
+
+[0xCA 0xCA][VER_MAJOR][VER_MINOR]
+
+4 octets
+
+====================================================
+C2N connection initialization success.
+Sent by node.
+ANON TLS
+
+[0x01 0x01]['O']['K']
+
+4 octets
+
+After this message client and node initiate ANON TLS session shutdown
+and after successful shutdown initiate new authenticated TLS session
+over the same TCP connection. Client acts as a TLS server and presents
+client sertificate, node acts as a TLS client and does not present
+certificate.
+====================================================
+Protocol versions mismatch.
+Sent by node.
+ANON TLS
+
+[0x02 0x02][VER_MAJOR][VER_MINOR]
+
+4 octets
+
+VER_MAJOR, VER_MINOR - Pica Pica protocol version supported by node
+
+This message is sent if node and client protocol versions are not equal.
+After sending and receiving this message TCP connection is closed by both
+hosts.
+====================================================
+Multilogin notification.
+Sent by client that logged in. Retranslated to other nodes.
+Delivered to existing connected client instance.
+
+[0x0E 0x0E][length 2 octets][timestamp][node address][signature from UH, timestamp, node
+address]
+
+timestamp - time when client logged in, 64-bit Unix timestamp in UTC timezone
+
+node address - one of 0xA0, 0xA1, 0xA2 message, announced address of the node
+which sending client is connected to.
+
+signature - digital signature using SHA224 hash and private RSA key of sending
+client. Signature is calculated from concatenated sender's UH, timestamp and
+node address = Sign(UH|timestamp|node address)
+
+
diff --git a/doc/proto.txt b/doc/proto.txt
index 3932b7f..a7f16ec 100755
--- a/doc/proto.txt
+++ b/doc/proto.txt
@@ -9,8 +9,7 @@ UH - user hash - SHA224 хэш от сертификата пользоватеÐ
+++[запрос на подключение] -клиент
0xCA 0xCA (Ver_major Ver_minor - версия протокола клиента, 2 байта)
-(MULTILOGIN_POLICY - 1 байт)
--5 байт
+-4 байт
===============новый вариант
+++[ответ сервера] - сервер