Owserver protocol

owserver protocol

owserver network protocol

  • Motivation

Paul Hilton started this discussion in the developer's list: http://article.gmane.org/gmane.comp.file-systems.owfs.devel/1501

  • What is it?

owserver separates the "front-end" applications using 1-wire (owfs owhttpd ...) from the actual adapter. In the process, it allows remote 1-wire adapters, and multiplexing (more than one front-end client ber adapter). The communication uses network messaging, specifically TCP over an arbitrary port.

  • Broad structure

A client initiates an exchange with owserver. Except for directory listings, there is a single client message and server response per interaction.

  • Message format:

This is defined in the source code at /module/owlib/src/include/ow_message.h

to Server Fixed header version assure protocol compatibility 4-byte network order
payload length (in bytes) of payload data 4-byte network order
type type of function call 4-byte network order
control_flags format flags 4-byte network order
size size of data element (for read or write) 4-byte network order
offset offset for read or write 4-byte network order
Variable payload variable length raw data
to Client Fixed header version assure protocol compatibility 4-byte network order
payload length (in bytes) of payload data 4-byte network order
ret return value of function call 4-byte network order
control_flags format flags 4-byte network order
size size of data element (for read or write) 4-byte network order
offset offset for read or write 4-byte network order
Variable payload variable length raw data
  • Message details see module/owlib/src/c/ow_server.c and module/owserver/src/c/owserver.c
==Object(stdClass)==
Message types explanation direction payload size ret value Payload contents
read Get a value TO name length expected size -- filename
BACK size -- 0 if ok value
write Set a value TO name+value length value length -- filename+value
BACK 0 -- 0 if ok --
dir list a directory TO name length -- -- dir name
BACK name length -- 0 if ok directory element
BACK ...
BACK 0 end of list marker
size(obsolete) length of a data field TO name length -- -- filename
BACK 0 0 <0 error, >0 length --
presence check existence of a device TO name length -- -- filename
BACK 0 -- 0 if ok --
ping response after 1.5 sec while gathering data TO (none)
BACK <0 -- -- --