Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
LabComm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Erik Jansson
LabComm
Commits
df8c6467
Commit
df8c6467
authored
10 years ago
by
Sven Gestegård Robertz
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of git.cs.lth.se:robotlab/labcomm-core
parents
1fed9bf1
bcfd7192
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/tech_report.tex
+58
-39
58 additions, 39 deletions
doc/tech_report.tex
with
58 additions
and
39 deletions
doc/tech_report.tex
+
58
−
39
View file @
df8c6467
...
@@ -289,6 +289,7 @@ With the following `example.lc` file:
...
@@ -289,6 +289,7 @@ With the following `example.lc` file:
and this
\verb
+
example_encoder.c
+
file
and this
\verb
+
example_encoder.c
+
file
\lstinputlisting
[basicstyle=\footnotesize,language=C]
{
../examples/wiki
_
example/example
_
encoder.c
}
\lstinputlisting
[basicstyle=\footnotesize,language=C]
{
../examples/wiki
_
example/example
_
encoder.c
}
\newpage
Running
\verb
+
./example_encoder one two
+
, will yield the following result in example.encoded:
Running
\verb
+
./example_encoder one two
+
, will yield the following result in example.encoded:
\begin{verbatim}
\begin{verbatim}
...
@@ -306,7 +307,9 @@ Running \verb+./example_encoder one two+, will yield the following result in exa
...
@@ -306,7 +307,9 @@ Running \verb+./example_encoder one two+, will yield the following result in exa
i.e.,
i.e.,
\begin{verbatim}
\begin{verbatim}
<version> <length: 12> <string: <len: 11> <"LabComm2014">>
<version> <length: 12> <string: <len: 11> <"LabComm2014">>
<sample
_
decl> <length: 48 <user
_
id: 0x40> <string: <len: 11> <"log
_
message">
<sample
_
decl> <length: 48
<user
_
id: 0x40>
<string: <len: 11> <"log
_
message">
<signature
_
length: 34>
<signature
_
length: 34>
<struct
_
decl:
<struct
_
decl:
<number
_
of
_
fields: 2>
<number
_
of
_
fields: 2>
...
@@ -379,37 +382,25 @@ VariableSize : Exp;
...
@@ -379,37 +382,25 @@ VariableSize : Exp;
\section
{
The LabComm protocol
}
\section
{
The LabComm protocol
}
\label
{
sec:ProtocolGrammar
}
\label
{
sec:ProtocolGrammar
}
Each LabComm2014 packet has the layout
\begin{verbatim}
<id> <length> <data...>
\end{verbatim}
where
\verb
+
length
+
is the number of bytes of the
\verb
+
data
+
part
(i.e., excluding the
\verb
+
id
+
and
\verb
+
length
+
fields), and
the
\verb
+
id
+
gives the layout of the
\verb
+
data
+
part as defined
in
\ref
{
sec:ConcreteGrammar
}
\subsection
{
Data encoding
}
LabComm primitive types are encoded as fixed width values, sent in
network order. Type fields, user IDs, number of indices and lengths are
sent in a variable length (
\emph
{
varint
}
) form. A varint integer value
is sent as a sequence of bytes where the lower seven bits contain a
chunk of the actual number and the high bit indicates if more chunks
follow. The sequence of chunks are sent with the least significant chunk
first.
The built-in data types are encoded as follows:
\begin{verbatim}
\begin{verbatim}
<packet> := ( <type
_
decl> | <sample
_
decl> | <sample
_
data> )*
<type
_
decl> := 0x01 ''(packed)'' <user
_
id> <string> <type>
<sample
_
decl> := 0x02 ''(packed)''<user
_
id> <string> <type>
<user
_
id> := 0x40..0xffffffff ''(packed)''
<string> := <string
_
length> <char>*
<string
_
length> := 0x00..0xffffffff ''(packed)''
<char> := any UTF-8 char
<type> := ( <basic
_
type> | <user
_
id> | <array
_
decl> | <struct
_
decl> )
<basic
_
type> := ( <boolean
_
type> | <byte
_
type> | <short
_
type> |
<integer
_
type> | <long
_
type> | <float
_
type> |
<double
_
type> | <string
_
type> )
<boolean
_
type> := 0x20 ''(packed)''
<byte
_
type> := 0x21 ''(packed)''
<short
_
type> := 0x22 ''(packed)''
<integer
_
type> := 0x23 ''(packed)''
<long
_
type> := 0x24 ''(packed)''
<float
_
type> := 0x25 ''(packed)''
<double
_
type> := 0x26 ''(packed)''
<string
_
type> := 0x27 ''(packed)''
<array
_
decl> := 0x10 ''(packed)'' <number
_
of
_
indices> <indices> <type>
<number
_
of
_
indices> := 0x00..0xffffffff ''(packed)''
<indices> := ( <variable
_
index> | <fixed
_
index> )*
<variable
_
index> := 0x00 ''(packed)''
<fixed
_
index> := 0x01..0xffffffff ''(packed)''
<struct
_
decl> := 0x11 ''(packed)'' <number
_
of
_
fields> <field>*
<number
_
of
_
fields> := 0x00..0xffffffff ''(packed)''
<field> := <string> <type>
<sample
_
data> := <user
_
id> <packed
_
sample
_
data>
<packed
_
sample
_
data> := is sent in network order, sizes are as follows:
||Type ||Encoding/Size ||
||Type ||Encoding/Size ||
||---------------||------------------------------------------------------||
||---------------||------------------------------------------------------||
||boolean || 8 bits ||
||boolean || 8 bits ||
...
@@ -419,18 +410,46 @@ VariableSize : Exp;
...
@@ -419,18 +410,46 @@ VariableSize : Exp;
||long || 64 bits ||
||long || 64 bits ||
||float || 32 bits ||
||float || 32 bits ||
||double || 64 bits ||
||double || 64 bits ||
||string || length
''(packed)''
, followed by UTF8 encoded string ||
||string || length
(varint)
, followed by UTF8 encoded string
||
||array || each variable index
''(packed)'',
||
||array || each variable index
(varint),
||
|| || followed by encoded elements ||
|| || followed by encoded elements ||
||struct || concatenation of encoding of each element ||
||struct || concatenation of encoding of each element ||
|| || in declaration order ||
|| || in declaration order ||
\end{verbatim}
\end{verbatim}
Type fields, user IDs, number of indices and lengths are sent in a packed, or
\subsection
{
Protocol grammar
}
variable length, form. An integer is sent as a sequence of bytes where the
\label
{
sec:ConcreteGrammar
}
lower seven bits contain a chunk of the actual number and the high bit
\begin{verbatim}
indicates if more chunks follow. The sequence of chunks are sent with the least
<packet> := ( <version> | <type
_
decl> | <sample
_
decl> | <sample
_
data> )*
significant chunk first. (The numbers encoded in this form are indicated above
<version> := 0x01 <length> <string>
with
\textit
{
(packed)
}
.)
<sample
_
def> := 0x02 <length> <user
_
id> <string> <type>
<type
_
def> := 0x03 <length> <user
_
id> <string> <type>
<user
_
id> := 0x40..0xffffffff
<string> := <string
_
length> <char>*
<string
_
length> := 0x00..0xffffffff
<char> := any UTF-8 char
<type> := <length> ( <basic
_
type> | <user
_
id> | <array
_
decl> | <struct
_
decl> )
<basic
_
type> := ( <boolean
_
type> | <byte
_
type> | <short
_
type> |
<integer
_
type> | <long
_
type> | <float
_
type> |
<double
_
type> | <string
_
type> )
<boolean
_
type> := 0x20
<byte
_
type> := 0x21
<short
_
type> := 0x22
<integer
_
type> := 0x23
<long
_
type> := 0x24
<float
_
type> := 0x25
<double
_
type> := 0x26
<string
_
type> := 0x27
<array
_
decl> := 0x10 <number
_
of
_
indices> <indices> <type>
<number
_
of
_
indices> := 0x00..0xffffffff
<indices> := ( <variable
_
index> | <fixed
_
index> )*
<variable
_
index> := 0x00
<fixed
_
index> := 0x01..0xffffffff
<struct
_
decl> := 0x11 <number
_
of
_
fields> <field>*
<number
_
of
_
fields> := 0x00..0xffffffff
<field> := <string> <type>
<sample
_
data> := <user
_
id> <packed
_
sample
_
data>
<packed
_
sample
_
data> := is sent in network order, encoded :
\end{verbatim}
\end{document}
\end{document}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment