From 5f2d62885578fba8c08802fec1c7212652d5a223 Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 24 Jan 2013 19:33:02 -0800 Subject: [PATCH] update protocol description --- xwords4/relay/xwrelay.h | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/xwords4/relay/xwrelay.h b/xwords4/relay/xwrelay.h index 0365a9b2a..de5fac534 100644 --- a/xwords4/relay/xwrelay.h +++ b/xwords4/relay/xwrelay.h @@ -33,41 +33,44 @@ typedef #endif enum { XWPDEV_NONE /* 0 is an illegal value */ + /* All messages have the following six-byte header + * proto: 1 byte + * msgID: 4 byte unsigned long, 0 an illegal value + * cmd: 1 byte, one of the values below. + */ + ,XWPDEV_ALERT /* relay->device: provides a string message to present to the user (with device allowed not to present the same string more than once) - format: proto: 1, this enum: 1, - null-terminnated string: varies */ + format: header, null-terminnated string: varies */ ,XWPDEV_REG /* dev->relay: device registers self and self-selected (e.g. gcm) or assigned devid - format: proto: 1; this enum: 1; idType: 1, + format: header, idType: 1, idLen: 2, id: */ ,XWPDEV_REGRSP /* relay->device: if non-relay-assigned devid type was given, this gives the relay-assigned one to be used from now on. - format: proto: 1, this enum: 1, idLen: 2, id: + format: header, idLen: 2, id: */ ,XWPDEV_PING /* device->relay: keep the UDP connection - open. format: proto: 1, this enum: 1. */ + open. header. */ ,XWPDEV_HAVEMSGS /* Relay->device: check messages for this - game. format: proto: 1, this enum: 1; clientToken: 4 */ + game. format: header */ ,XWPDEV_RQSTMSGS /* device->relay: got any messages for me? - format: proto: 1, this enum 1, devID: 4 [, clientToken: 4] + format: header, devID: 4 [, clientToken: 4] */ ,XWPDEV_MSG /* dev->relay and relay->dev: norm: a message from a game to - the relay format: proto: 1, this enum: 1, - clientToken: 4, message*/ + the relay format: header, clientToken: 4, message*/ ,XWPDEV_MSGNOCONN /* dev->relay in the proxy format that includes relayID (connname:hid) and seems to be reserved for relay FWD messages. - format: proto: 1, this enum: 1, - clientToken: 4; -terminated-connname: + format: header, clientToken: 4; -terminated-connname: varies, message: varies */ ,XWPDEV_MSGRSP /* relay->dev: conveys error on receipt of XWPDEV_MSG */ @@ -75,7 +78,11 @@ enum { XWPDEV_NONE /* 0 is an illegal value */ ,XWPDEV_BADREG /* relay->dev. You sent me a relayID via XWPDEV_REG but I've never heard of it */ - ,XWPDEV_ACK + ,XWPDEV_ACK /* tells recipient its message has been + received. This is for debugging, and maybe + later for timing keepAlives based on + firewall timeouts. format: header, msgID: 4 + */ } #ifndef CANT_DO_TYPEDEF