RWE is a remote management protocol. It is "spoken" by the client(management tool) and server(daemon on the machine that is being managed). RWE stands for:
and that's what this protocol is all about. It provides easy and more or less convenient way to interact with the remote operating system in a programmable fashion.
RWE connection consists of establishment of network connection, greeting from the server, and client/server interaction. Interaction consist of commands issued by client and data returned by the server as a response/result to the client's command. This exchange of commands and results is in the form of lines(CRLF ending strings).
Session (bird view)
Client command begins the interaction. Each command consists of: command tag, command type, and command itself. These different command parts are divided by divider string(that string is <-RWE-> in default implementation). Command tag is a random number and should be preserved for later identification of response made by server. After issuing a command client should not block while waiting for results but instead it can issue any number of commands more. At any point in time client should be ready to receive and handle results from the server.
Server response consists of: command tag(same one that was received from client), command type(same as received from client), and a result to client's command. These different response parts are divided by divider string. Responses to all client commands are single lines with the exception of WATCH and EXEC_STATUS which are multiline responses(every time watched file changes, response is sent back to the client or in case of EXEC_STATUS response is sent periodically to inform the client about issued command's progress).
Command types
There are 4 major command types is RWE and those are: READ, WRITE, EXEC and WATCH. EXEC has two sibling commands: EXEC_MULTI and EXEC_STATUS. Short description of each would be:
EXEC - instructs the server to executu a binary program with given arguments:
898723327<-RWE->EXEC<-RWE->/usr/bin/uname<-RWE->-a
EXEC_MULTI - instructs the server to execute the binary multiple times, each time with different set of arguments:
272767632<-RWE->EXEC_MULTI<-RWE->/usr/bin/uname<-RWE->1<-RWE->-a<-RWE->-m<-RWE->-n
EXEC_STATUS - instructs the server to execute the binary, but instead of receiving single result about commands execution, it receives status updates about commands execution fallowed by the final result.
873029378<-RWE->EXEC_STATUS<-RWE->/sbin/ping<-RWE->1<-RWE->yahoo.com
!NOT COMPLETE!
For the rest check the relevant source files in my OFInst project.
category: /projects/rweprotocol | permalink