summaryrefslogtreecommitdiff
path: root/server/ptp.rst
diff options
context:
space:
mode:
Diffstat (limited to 'server/ptp.rst')
-rw-r--r--server/ptp.rst51
1 files changed, 30 insertions, 21 deletions
diff --git a/server/ptp.rst b/server/ptp.rst
index 8aef2b7..7c40a3b 100644
--- a/server/ptp.rst
+++ b/server/ptp.rst
@@ -1,4 +1,4 @@
-Piztor Transmission Protocol v0.2
+Piztor Transmission Protocol v0.3
---------------------------------
- General
@@ -8,7 +8,7 @@ Piztor Transmission Protocol v0.2
::
+---4b---+---1b---+-------?b--------+
- | LENGTH | OPT ID | SPECIFIC DATA |
+ | LENGTH | OPT_ID | SPECIFIC DATA |
+--int---+-uchar--+-----------------+
- Response
@@ -16,11 +16,20 @@ Piztor Transmission Protocol v0.2
::
+---4b---+---1b---+------?b---------+
- | LENGTH | OPT ID | SPECIFIC DATA |
+ | LENGTH | OPT_ID | SPECIFIC DATA |
+--int---+-uchar--+-----------------+
- Notice that in following sections, ``LENGTH`` part is left out for clarity.
- TODO: All secure requests should have username or uid provided.
+ Notice:
+
+ - In following sections, ``LENGTH`` part is left out for clarity.
+ - ``PADDING`` has value ``0``.
+ - ``AUTH_HEAD`` structure:
+
+ ::
+
+ +----32b-----+----?b----+----1b---+
+ | USER_TOKEN | USERNAME | PADDING |
+ +----raw-----+----------+---------+
- Authentication
@@ -28,22 +37,22 @@ Piztor Transmission Protocol v0.2
::
- +--1b---+-----?b------+-----?b-----+
- | 0x00 | USERNAME | PASSWORD |
- +-uchar-+-------------+------------+
+ +--1b---+-----?b------+----1b----+-----?b-----+
+ | 0x00 | USERNAME | PADDING | PASSWORD |
+ +-uchar-+-------------+----------+------------+
- Response
::
- +--1b---+---1b---+---4b----+----16b-----+
+ +--1b---+---1b---+---4b----+----32b-----+
| 0x00 | STATUS | USER_ID | USER_TOKEN |
+-uchar-+--uchar-+---int---+----raw-----+
``STATUS`` :
- - 0x00 for success
- - 0x01 for failure
+ - ``0x00`` for success
+ - ``0x01`` for failure
- Location Update
@@ -51,22 +60,22 @@ Piztor Transmission Protocol v0.2
::
- +--1b---+-----16b------+-----8b-----+------8b-----+
- | 0x02 | USER_TOKEN | LATITUDE | LONGITUDE |
- +-uchar-+------raw-----+---double---+---double----+
+ +--1b---+-----?b------+----8b------+------8b-----+
+ | 0x01 | AUTH_HEAD | LATITUDE | LONGITUDE |
+ +-uchar-+-------------+---double---+---double----+
- Response
::
+--1b---+---1b---+
- | 0x02 | STATUS |
+ | 0x01 | STATUS |
+-uchar-+--uchar-+
``STATUS`` :
- - 0x00 for success
- - 0x01 for invalid token
+ - ``0x00`` for success
+ - ``0x01`` for invalid token
- Location Information
@@ -74,16 +83,16 @@ Piztor Transmission Protocol v0.2
::
- +--1b---+-----16b------+------4b-----+
- | 0x03 | USER_TOKEN | GROUP_ID |
- +-uchar-+-----raw------+-----int-----+
+ +--1b---+------?b------+------4b-----+
+ | 0x02 | AUTH_HEAD | GROUP_ID |
+ +-uchar-+--------------+-----int-----+
- Response
::
+--1b---+---1b---+-----4b----+------20b-------+-----+
- | 0x03 | STATUS | ENTRY_CNT | LOCATION_ENTRY | ... |
+ | 0x02 | STATUS | ENTRY_CNT | LOCATION_ENTRY | ... |
+-uchar-+-uchar--+----int----+----------------+-----+
``LOCATION_ENTRY`` :