view docs/extension-pingpong.txt @ 10:36c4cda4b6c4

Add extension support with the PINGPONG extension Add extension support. There are two ways to add extensions: 1. as a shared object which will be loaded with ext=<filename> as a parameter to lwwire. See the lwwire_pingpong.c file for details. 2. By doing basically the same thing as a shared object but linking it into the main binary and calling lwwire_register_extension() appropriately.
author William Astle <lost@l-w.ca>
date Sat, 30 Jul 2016 13:16:39 -0600
parents
children
line wrap: on
line source

This document describes an extension to the LWWire protocol which provides
a "PINGPONG" facility. It does not provide a generally useful service.
However, it does serve to show how a basic extension can be defined. It also
gives clients an option to enable an extension and use that to determine if
the server has reset or otherwise got into a mixed up state. For instance,
the client could negotiate the PINGPONG extension and then periodically send
a PINGPONG_PING operation. If it doesn't get the appropriate response, it
can then assume that the server has reset and it should re-initialize its
drivers.

LWWire Protocol Extension
=========================

This extension is called PINGPONG and is assigned extension number DF. It
defines the following operations in its extension space.

00 PINGPONG_PING

This does just what it's name implies. It does nothing except reply to the
client.

Request:

Octet	Meaning
-----	-------
0-2	F3 DF 00

Response:

Octet	Meaning
-----	-------
0	42

The response will always be 42.

01 PINGPONG_PONG

This is exactly like PINGPONG_PING. It's provided for humour value.

Request:

Octet	Meaning
-----	-------
0-2	F3 DF 01

Response:

Octet	Meaning
-----	-------
0	42

The response will always be 42.