Xebra Module Communication Protocol

Revision as of 11:08, 30 June 2009 by Fabioz (Talk | contribs) (New page: Category:Xebra =Basic Communication= For every string message that is to be sent between a module and server, the sender first sends the length of the message ENCODED_MESSAGE_LENGTH a...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Basic Communication

For every string message that is to be sent between a module and server, the sender first sends the length of the message ENCODED_MESSAGE_LENGTH and then the message MESSAGE. The max length FRAG_SIZE of a message to be sent is 65536 bytes. If a message is longer, it is divided into fragments. ENCODED_MESSAGE_LENGTH is called ENCODED_ because it also contains a FRAG_FLAG which specifies if the next message is a fragment and has to be assembled to a whole message after receiving.

Let's say the server wants so send a message of size 150'000 bytes to the module. The following would be sent: [65536 FRAG_FLAG=1][Message part 1...][65536 FRAG_FLAG=1][Message part 2....][18928 FRAG_FLAG=0][Message part 3....]

The ENCODED_MESSAGE_LENGTH is constructed as follows: The lenght of the message (integer) is shifted by 1 bit to the left. Then the most right bit is set to FRAG_FLAG.

Request Message

For every request, the module sends a message of the following format to the server:

REQUEST = HEADER, HEADERS_IN, HEADERS_OUT, SUBPROCESS_ENVIRONMENT_VARS, (FORM_ARGUMENTS|TEXT_ARGUMENTS)
HEADER = METHOD , " " , url, " HTTP/1.1"
METHOD = "GET" | "POST"
HEADERS_IN = "#HI#",  {"#$#", item_name, "#%#", item_value}* , "#E#"
HEADERS_OUT = "#HO#",  {"#$#", item_name, "#%#", item_value}* , "#E#"
SUBPROCESS_ENVIRONMENT_VARS = "#SE#",  {"#$#", item_name, "#%#", item_value}* , "#E#"
FORM_ARGUMENTS = "#A#",  {"#$#", arg_name, "=", arg_value}* , "#E#"
TEXT_ARGUMENTS = "#A##TEXT/XML#",  arg_value, "#E#"

Example

 

Response Message

The server answers with a response message of the following format:

RESPONSE = {COOKIE_ORDER}*, CONTENT_TYPE, HTML
COOKIE_ORDER = "#C#", cookie_name, "=", cookie_value, COOKIE_OPT, ";Version=1#CE#"
COOKIE_OPT = [';', "Domain=", cookie_domain],
             [';', "Max-Age=", cookie_max_age],     
             [';', "Path=", cookie_path],
             [';', "Secure"]
CONTENT_TYPE = "#CT#", content-type
HTML = "#H#", html_code

Example