![]() |
Protocol Description
| |||||||||||||||||||||||||||||||||||||||||
|
About the Group Description Proposal Parts List Update 1 Update 2 Timeline Status |
PurposeThis document's purpose is to fully specify the protocol as it is working now. The specifications contained within are not intended to reflect the theoretical ideal of how the communication protocol should be. Instead, this document aims to define the protocol to compromise for ease of implementation within our resource constraints, while demonstrating proof of concept.The server is the data store system. The server is currently implemented as a Java program, running on a PC. The server is responsible for sending, receiving, and synchronizing user data across all of the various scrap devices. The storage of the data is handled by an SQL database.
ParadigmOur infrastructure organizes data types into discrete sets. In theory, the data can be organized by a richer type description, like MIME. As a compromise, we named the data types with the same names as the applications that handle their particular types. These tags are:
Individual data items themselves are discrete packages. The packages have various components, depending on the data type. All packages of the same type have the same component sets. Because our data storage is in an SQL database, you should think of the data types as individual tables. Each data package is just a row in one of those tables. The components in a package are the columns within the table. Refer to the Database Draft to see the database organization.
BootstrapCommunication of user data occurs between the server and devices only. That is, devices don't communicate with other devices. Our medium is ethernet, using TCP/IP. Each device in the infrastructure has a unique IP number. The server exists on an IP address known to all devices. Communication is initiated by devices always. That is, the server cannot connect to devices. This simplification was done to ease development on the devices. Once a device has created an open socket to the server, the server can reply any necessary data back to the device through the open socket. Each application is responsible for making their own connection. In another words, we treat all applications as if they are their own device. In brief, a usual sequence of events, from the application perspective would occur as follows:
Logonsent from Device to Server The logon event is issued by devices to initiate itself as being owned by a specific user. This event should be sent once and only once for every time a scrap device is assigned ownership. The Logon event should be the FIRST thing sent to the server. to log on, device sends the server the following sequence: <logon><uid>user ID number</uid></logon> The sequence should be terminated with a NULL character to indicate the end of the XML stream. In the logon string, "user ID number" is a 32-bit unsigned integer, uniquely identifying users of the system.
Logon Replysent from Server to Device The logon reply is sent by the server to the device to acknowledge or deny the device being associated to the user. This reply comes immediately after the device sends its Logon request. The device should NOT send anything more until this logon reply comes from the server. The following sequence is returned: <logon><uid>user ID number</uid><ack>true|false</ack></logon> This sequence IS NOT NULL terminated.
If the device receives a
If the device receives a
Logoffsent from Device to Server The logof event is issued by devices to de-associate itself from an owner. This event should be sent once and only once for every time a device is disowned and returned to a scrap state. to log off, device sends the server the following sequence: <logoff><uid>user ID number</uid></logoff> The sequence should be terminated with a NULL character to indicate the end of the XML stream. In the logon string, "user ID number" is a 32-bit unsigned integer, uniquely identifying users of the system. Once a device has sent this to the server, the device can assume the server has disassociated the device from the user. The device should close all sockets to the server, and return to scrap state.
Snapshot Requestsent from Device to Server This message is sent by an application to request data sets from the server. <snapshot><application></application></snapshot> The sequence should be terminated with a NULL character to indicate the end of the XML stream.
The
Snapshot Replysent from Server to Device This is sent by the server to the device in response to a snapshot request. <snapshot><application>...</application></snapshot> This sequence IS NOT NULL terminated. The data that's contained between the application tags is application dependent. However, there are a few invariants which can be held for all content within the application tags. All of the tags and fields will be present. That is, the complete state of the entry is sent. Furthermore, the tags always appear in the same order. More information will be detailed in each application's section. Furthermore, each snapshot return contains only one entry. If there are more than one entries to return, then they will be sent with multiple snapshot replies.
Updatesent from Device to Server This is sent by devices when there has been data change. That is, if the user added, modified, or deleted data, then the device should send this message to the server. <update><mode>add|modify|delete</mode><application>...</application></snapshot> The sequence should be terminated with a NULL character to indicate the end of the XML stream. The selection criteria support depends on the application module. However, it can be assumed that the best way to modify is to specifically set the ID of the data entry.
Note that on an
Synchbroadcast from Server to all Devices owned by user This is the parallel to the update message. When the user owns multiple devices, and a data entry somewhere gets modified, this message is sent to all devices notifying them of the change, including the originator of the message. <synch><mode>add|modify|delete</mode><application>...</application></synch> This sequence IS NOT NULL terminated. The data contained within the application tags is always complete. That is, all fields are present, given, and filled in.
MessageAppTo get our system to work without adding more protocol tags, the MessageApp hacks the way the existing protocol is used. This section will hopefully clarify how the MessageApp works. starting upWhen the MessageApp first opens, it should send a snapshot request.
The server will then respond with a whole bunch of snapshots. The first set of these snapshots are actually to send the application the list of people on the system. Right afterwards, the server will send more snapshots, but these contain outstanding messages the user has not yet read. Snapshots that have no
sending a message
to send a message, the application sends an
HOWEVER, we overload the usage of the
getting a messageThis message is sent by the server to all devices owned by a user to notify that an instant message has come in.
reading a message
once a user has read a message, the application should send this package to the server to indicate that the message has been read. That allows the server to broadcast that to all other devices owned by that user. Note that the
synchronizing on message readThis message is sent by the server to all devices owned by the user to notify all devices that a particular message got read. Note that the broadcast includes the device that generated the original 'message read' packet.
| |||||||||||||||||||||||||||||||||||||||||
comments to 476scrap@cs.washington.edu