[Y-devel] Y-Protocol proposal, again :-)
Andreas Karafyllis ankar at homodigitalis.net
Mon Apr 12 22:31:44 BST 2004
This is an updated, more complete, proposal for changes in the Y protocol using the XDR language.
(See RFC 1014 https://www.faqs.org/rfcs/rfc1014.html for a description of XDR)
It is based on the latest version of the protocol, I hope :-).
It tries to be better in the following areas:
1. Clear and more complete definition independent of a programming language
2. Padding of member values so that all values are 4-byte aligned
3. Removal of superfluous fields in members
Please have in mind that I first learned about the existence of XDR before
some hours. In case I have some errors, please correct them and repost
the message to the mailing list.
Switch to fixed fonts with no wordwrap if you did not already...
Thanks to Rogelio Serano for sending the RFC link of the XDR
Bye
Andreas Karafyllis
/* Proposal for Y-Protocol */
/**********************************/
/* Constants and type definitions */
/**********************************/
enum member_type { Y_STRING = 0, Y_UINT32 = 1, Y_INT32 = 2, Y_UNDEFINED = 256}
/* Currently, there is no distiction between opcodes sent from
a client application to the server and vice-versa.
I propose the following:
All opcodes that have as destination the server are named OP_SERVER_* and
are in the range 0x00000000 - 0x0000FFFF
All opcodes that have as destination the client are named OP_CLENT_* and
are in the range 0x00010000 - 0x7FFFFFFF
*/
enum opcode {
OP_SERVER_SOMETHING_0 = 0x00000001,
OP_SERVER_SOMETHING_1 = 0x00000002,
OP_SERVER_SOMETHING_1 = 0x00000003,
...
OP_CLIENT_SOMETHING_0 = 0x00010000,
OP_CLIENT_SOMETHING_1 = 0x00010002,
OP_CLIENT_SOMETHING_2 = 0x00010003,
...
}
/* The type "member" is used to represent arguments of operations */
typedef union switch (member_type mt) {
case Y_STRING:
string string_data<>;
case Y_UINT32:
unsigned int uint_data;
case Y_INT32:
int int_data;
case Y_UNDEFINED:
opaque undefined_data<>;
} member;
/**************************/
/* A complete Y-messsage */
/**************************/
struct {
unsigned int len; /* The complete length of the message including this field. */
unsigned int seq; /* sequential number */
unsigned int from; /* source */
unsigned int to; /* destination */
unsigned int id; /* client id */
unsigned int ext1; /* for future extensions.., */
union switch (opcode op) { /* opcode followed by a variable member array */
case OP_WITH_NO_ARGUMENTS
/* This is equivelant with a zero */
member no_args<0>;
case OP_WITH_1_ARGUMENT
member op_1_member<1>;
case OP_WITH_2_ARGUMENT
member op_2_members<2>;
case OP_WITH_VARIABLE_NUMBER_OF_ARGUMENTS:
member op_n_members<>
} members;
} y_message;
/* The above spec does not specify what kind of arguments each operation has
I suggest that we will describe this information like this:
OP_WITH_NO_ARGUMENTS : -
OP_WITH_1_ARGUMENT : Y_STRING arg1
OP_WITH_2_ARGUMENTS : Y_INT32 arg1, Y_STRING arg2
OP_WITH_VARIABLE_NUMBER_OF_ARGUMENTS: Y_STRING list_of_args<>
*/
More information about the Y-devel mailing list
2026 © www.Y-Windows.Org - All Rights Reserved