PushCacheProtocol
Characteristics of the protocol used to control the push cache, and
methods for common operations
Protocol Description
To request that "/home/abc/page.html" is inserted in cache as
"http://www.abc.com/page.html" the client sends a packet with
command="ADD", and remain_len set to sizeof(add_packet_t) plus
the sum of the lengths of the path and the urls including their
null terminators. The client then sends an add_packet describing
the lengths of the two strings followed by the path and then the
url.
The server replies with either command="OK" and remain_len=0 or
command="ERR" and remain_len set the the length of the error
string that follows immediately. In the event of an "ERR" message
the connection is closed by the server.
To request that the page associated with "http://www.abc.com/page.html"
be removed from the cache the client sends a packet with command="DEL",
and remain_len set to sizeof(int) plus the length of the url string
including the trailing null character. The server replies as with
ADD above. Attempting to remove a url that is not present in the cache
results in an "OK" packet being returned, the cache is unchanged.
The client can ask if a url is present in the cache by sending a packet
with command="PRS", and url information as with the DEL command. The
server will reply with "OK" if the url is present, "NO" if the url is
not present and "ERR" if an error was encountered.
The client can request that the cache be emptied of all urls by sending
a packet with command="CLN" (clean). The remain_len field is set to zero.
The server will reply with either OK or ERR.
The client can terminate the dialogue by sending a command="BYE"
packet and then closing the connection.
'C' code describing the packet structures are shown below
typedef struct {
// Bytes Notes
// ----- -----
char tag[4]; // 0-3 = {'P','C','P','P'}
short major_version; // 4-5 = 1
short minor_version; // 6-7 = 1
char command[4]; // 8-11 Null terminated command string
int remain_len; // 12-15 number of remaining bytes to read
} packet_t;
typedef struct {
int path_len; // 4 Length of pathname (including null)
int url_len; // 8 Length of URL (including null)
} add_packet_t;
Note that the command is always 4 characters in length and that the
null characters are considered part of the command, so in Java (but
not C) we must include the \0 when comparing strings:
"ADD\0", "BYE\0", "OK\0\0", "ERR\0", "CLN\0", "PRS\0", "DEL\0"
author: Paul Henshaw, The Fantastic Corporation, Paul.Henshaw@fantastic.com version: $Revision: 1.1 $ version: $Id: PushCacheProtocol.java,v 1.1 2001/10/03 15:00:46 ylafon Exp $ |