module TSTPMessage { enum MessageType { Request, Reply } enum Operation { ECHO, REVERT, TOUPPER, TOLOWER } interface RequestHeader { MessageType type; // unsigned char Operation operationId; // unsigned char unsigned short dataLength; // two bytes } interface ReplyHeader { MessageType type; // unsigned char unsigned short dataLength; // two bytes } } // There are two messages: RequestMessage and ReplyMessage. // // RequestMessage // // The RequestMessage contains a RequestHeader and a RequestBody. // The RequestBody contains as many bytes as specified by dataLength. // The RequestMessage encodes a string to be processed, together // with the operation to be performed on that string. // // ReplyMessage // // The ReplyMessage contains a ReplyHeader and a ReplyBody. // The ReplyBody contains as many bytes as specified by dataLength. // The ReplyMessage encodes the result of applying an operation // to a string. Both the operation and the string were received // in the corresponding RequestMessage. The result is also a string // (no other results yet :( ) // // dataLength Coding Convention // // The member dataLength that appears in both headers is coded // using 'Little Endian' notation.