Artifact Content
Not logged in

Artifact 564cf530a97f1f25941fc13f8171b762845c0768:


#LyX 2.0 created this file. For more info see http://www.lyx.org/
\lyxformat 413
\begin_document
\begin_header
\textclass beamer
\begin_preamble
%\usetheme{Warsaw}
% or ...
\usetheme{lankton-keynote}

\setbeamercovered{transparent}
% or whatever (possibly just delete it)
\usepackage{fontspec}
%\newfontface\cjk{ShanHeiSun-Uni}
%\newfontface\cjk{BousungEG-Light-GB}
\newfontface\cjk{GBZenKai-Medium}
%\newfontface\cjk{ZenKai-Medium}
%\newfontface\cjk{ShanHeiSun-Light}
%\newfontface\cjk{ZenKai-Uni}
\end_preamble
\options aspectratio=169
\use_default_options false
\maintain_unincluded_children false
\language american
\language_package auto
\inputencoding utf8x
\fontencoding global
\font_roman default
\font_sans default
\font_typewriter default
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100

\graphics default
\default_output_format pdf5
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize 12
\spacing single
\use_hyperref false
\papersize default
\use_geometry true
\use_amsmath 2
\use_esint 0
\use_mhchem 1
\use_mathdots 1
\cite_engine basic
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\use_refstyle 0
\index Stichwortverzeichnis
\shortcut idx
\color #008000
\end_index
\secnumdepth 2
\tocdepth 2
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Title
net
\begin_inset ERT
status open

\begin_layout Plain Layout


\backslash
kern-.8ex
\backslash
lower1.5ex
\backslash
hbox{
\end_layout

\end_inset


\begin_inset Graphics
	filename net2o-logo.pdf
	lyxscale 10
	scale 10

\end_inset


\begin_inset ERT
status open

\begin_layout Plain Layout

}
\backslash
kern-.5ex
\end_layout

\end_inset

: Command Language
\begin_inset Argument
status open

\begin_layout Plain Layout
net2o app layer
\end_layout

\end_inset


\end_layout

\begin_layout Subtitle
A universal language for structured data and RPC
\end_layout

\begin_layout Author
Bernd Paysan
\end_layout

\begin_layout Date
September 26, EuroForth 2014, Palma de Mallorca
\end_layout

\begin_layout Standard
\begin_inset ERT
status open

\begin_layout Plain Layout


\backslash
addtobeamertemplate{headline}{}{
\backslash
vbox{
\backslash
vspace{3ex}
\backslash
hbox to
\backslash
paperwidth{
\backslash
hfill
\end_layout

\end_inset


\begin_inset Graphics
	filename net2o-logo.pdf
	lyxscale 5
	scale 5

\end_inset


\begin_inset ERT
status open

\begin_layout Plain Layout

~~~}}}
\end_layout

\end_inset


\end_layout

\begin_layout BeginFrame
Overview
\end_layout

\begin_layout Standard
\begin_inset CommandInset toc
LatexCommand tableofcontents

\end_inset


\end_layout

\begin_layout EndFrame

\end_layout

\begin_layout Section
Motivation
\end_layout

\begin_layout EndFrame

\end_layout

\begin_layout BeginFrame
Forth--Style Communication
\end_layout

\begin_layout Standard
Requirements for secure communication (secure as in 
\begin_inset Quotes eld
\end_inset

no exploitation through misinterpretation
\begin_inset Quotes erd
\end_inset

)
\end_layout

\begin_layout Pause

\end_layout

\begin_layout Itemize
Extremely simple interpreter
\end_layout

\begin_deeper
\begin_layout Pause

\end_layout

\end_deeper
\begin_layout Itemize
Extensible, but extensions must be allowed by the receiver
\end_layout

\begin_deeper
\begin_layout Pause

\end_layout

\end_deeper
\begin_layout Itemize
Universal, i.e.
 only one interpreter to audit and verify
\end_layout

\begin_deeper
\begin_layout Pause

\end_layout

\end_deeper
\begin_layout Itemize
Triviality makes it difficult to explain
\end_layout

\begin_layout EndFrame

\end_layout

\begin_layout Section
Object Oriented Forth Code as Data
\end_layout

\begin_layout BeginFrame
Basics
\end_layout

\begin_layout Itemize
Five data types: Integer (64 bits signed+unsigned), flag, string (generic
 byte array), IEEE double float, objects
\end_layout

\begin_deeper
\begin_layout Pause

\end_layout

\end_deeper
\begin_layout Itemize
Instructions and data encoding derived from Protobuf (7 bits per byte, MSB=1
 means 
\begin_inset Quotes eld
\end_inset

data continues
\begin_inset Quotes erd
\end_inset

, most significant part first)
\end_layout

\begin_deeper
\begin_layout Pause

\end_layout

\end_deeper
\begin_layout Itemize
Four stacks: integer, float, objects, strings
\end_layout

\begin_deeper
\begin_layout Pause

\end_layout

\end_deeper
\begin_layout Itemize

\family typewriter
endwith
\family default
 and 
\family typewriter
endcmd
\family default
 for ending object message blocks and commands
\end_layout

\begin_deeper
\begin_layout Pause

\end_layout

\end_deeper
\begin_layout Itemize

\family typewriter
oswap
\family default
 to transfer the current object to the object stack, to be inserted in the
 outer object
\end_layout

\begin_deeper
\begin_layout Pause

\end_layout

\end_deeper
\begin_layout Itemize

\family typewriter
words
\family default
 for reflection (words are listed with token number, identifier and stack
 effect to make automatic bindigs possible)
\end_layout

\begin_layout EndFrame

\end_layout

\begin_layout BeginFrame
Why binary encoding?
\end_layout

\begin_layout Itemize
Faster and simpler to parse (simpler means smaller attack vector)
\end_layout

\begin_deeper
\begin_layout Pause

\end_layout

\end_deeper
\begin_layout Itemize
Ability to enter commands on the fly in text form through a frontend interpreter
 still exists
\end_layout

\begin_deeper
\begin_layout Pause

\end_layout

\end_deeper
\begin_layout Itemize
Debugging with a de--tokenizer is also very easy
\end_layout

\begin_deeper
\begin_layout Pause

\end_layout

\end_deeper
\begin_layout Itemize
Object--oriented approach makes writing application--specific logic extremely
 simple
\end_layout

\begin_layout EndFrame

\end_layout

\begin_layout BeginFrame
Why a programming language as data?
\end_layout

\begin_layout FrameSubtitle
Lemma: every glue logic will become Turing complete
\end_layout

\begin_layout Itemize
Implement only the things you need --- but you shouldn't have to implement
 more than 
\emph on
one
\emph default
 generic interpreter
\end_layout

\begin_deeper
\begin_layout Pause

\end_layout

\end_deeper
\begin_layout Itemize
Typical idea of sending remote procedure calls: serialize the entire object
 (with subobjects), and call a function on that object
\end_layout

\begin_deeper
\begin_layout Pause

\end_layout

\end_deeper
\begin_layout Itemize
Net2o idea (derived from ONF): Keep the entire object synchronized by sending
 only the changes to it --- these changes are simple messages (setters)
\end_layout

\begin_deeper
\begin_layout Pause

\end_layout

\end_deeper
\begin_layout Itemize
This allows multi--message passing, and reduces latency
\end_layout

\begin_layout EndFrame

\end_layout

\begin_layout BeginFrame
Security
\end_layout

\begin_layout FrameSubtitle
Lemma: every sufficiently complex format can be exploited
\end_layout

\begin_layout Standard
Therefore stick to a very simple format, i.e.: simplify and factor the code
\end_layout

\begin_layout Pause

\end_layout

\begin_layout Block
\begin_inset ERT
status open

\begin_layout Plain Layout

{Interpreter}
\end_layout

\end_inset


\end_layout

\begin_deeper
\begin_layout LyX-Code
: cmd@ ( -- u )
\end_layout

\begin_layout LyX-Code
  buf-state 2@ over + >r p@+ r> over - buf-state 2! 64>n ;
\end_layout

\begin_layout LyX-Code
: n>cmd ( n -- addr )  cells >r
\end_layout

\begin_layout LyX-Code
  o IF   token-table  ELSE  setup-table  THEN
\end_layout

\begin_layout LyX-Code
  $@ r@ u<= IF  net2o-crash  THEN  r> + ;
\end_layout

\begin_layout LyX-Code
: cmd-dispatch ( addr u -- addr' u' )  buf-state 2!
\end_layout

\begin_layout LyX-Code
  cmd@ n>cmd @ ?dup IF  execute  ELSE  net2o-crash  THEN
\end_layout

\begin_layout LyX-Code
  buf-state 2@ ;
\end_layout

\begin_layout LyX-Code
: cmd-loop ( addr u -- )
\end_layout

\begin_layout LyX-Code
  BEGIN  cmd-dispatch dup 0<= UNTIL  2drop ;
\end_layout

\end_deeper
\begin_layout EndFrame

\end_layout

\begin_layout Section
A Few Examples
\end_layout

\begin_layout BeginFrame
Reading Files
\end_layout

\begin_layout ExampleBlock
\begin_inset ERT
status open

\begin_layout Plain Layout

{
\end_layout

\end_inset


reading three files
\lang american

\begin_inset ERT
status open

\begin_layout Plain Layout

}
\end_layout

\end_inset


\end_layout

\begin_deeper
\begin_layout LyX-Code
0 lit, file-id "net2o.fs" $, 0 lit,
\end_layout

\begin_layout LyX-Code
open-file <req-file get-size get-stat req> endwith
\end_layout

\begin_layout LyX-Code
1 lit, file-id "data/2011-05-13_11-26-57-small.jpg" $, 0 lit,
\end_layout

\begin_layout LyX-Code
open-file <req-file get-size get-stat req> endwith
\end_layout

\begin_layout LyX-Code
2 lit, file-id "data/2011-05-20_17-01-12-small.jpg" $, 0 lit,
\end_layout

\begin_layout LyX-Code
open-file <req-file get-size get-stat req> endwith
\end_layout

\end_deeper
\begin_layout EndFrame

\end_layout

\begin_layout BeginFrame
Reading Files: Reply
\end_layout

\begin_layout ExampleBlock
\begin_inset ERT
status open

\begin_layout Plain Layout

{
\end_layout

\end_inset


reading three files
\lang american
: replies
\begin_inset ERT
status open

\begin_layout Plain Layout

}
\end_layout

\end_inset


\end_layout

\begin_deeper
\begin_layout LyX-Code
0 lit, file-id 12B9A lit, set-size
\end_layout

\begin_layout LyX-Code
    138D607CB83D0F06 lit, 1A4 lit, set-stat endwith
\end_layout

\begin_layout LyX-Code
1 lit, file-id 9C65C lit, set-size
\end_layout

\begin_layout LyX-Code
    13849CAE1F3B6EA8 lit, 1A4 lit, set-stat endwith
\end_layout

\begin_layout LyX-Code
2 lit, file-id 9D240 lit, set-size
\end_layout

\begin_layout LyX-Code
    13849CAE2643FDCC lit, 1A4 lit, set-stat endwith
\end_layout

\end_deeper
\begin_layout EndFrame

\end_layout

\begin_layout BeginFrame
Messages
\end_layout

\begin_layout ExampleBlock
\begin_inset ERT
status open

\begin_layout Plain Layout

{
\end_layout

\end_inset

messages
\begin_inset ERT
status open

\begin_layout Plain Layout

}
\end_layout

\end_inset


\end_layout

\begin_deeper
\begin_layout LyX-Code
msg 13977C927BF7F1AA lit, msg-at  "Hi Bob!" $, msg-text
\end_layout

\begin_layout LyX-Code
    85" Z(&3*>qxl*bWM*DUCA-Mf9N~u;<ddcW0C<XR)ezh?=jmn7zq4RFduAe=aOjKE*2y)I`t;Xi^
buBc*@f2"
\end_layout

\begin_layout LyX-Code
    $, msg-sig endwith 
\end_layout

\begin_layout LyX-Code
85" e}&3&Kep3Im`T3?tIU=8fs>4=(C`Uic<rhs{(J`k&c5k8{H2^0*}`rV0(F3e"
\end_layout

\begin_layout LyX-Code
$, push-$ push' nest 0 lit, ok?
\end_layout

\end_deeper
\begin_layout EndFrame

\end_layout

\begin_layout BeginFrame
Structured Text a la HTML
\end_layout

\begin_layout ExampleBlock
\begin_inset ERT
status open

\begin_layout Plain Layout

{
\end_layout

\end_inset


HTML--like structured text
\lang american

\begin_inset ERT
status open

\begin_layout Plain Layout

}
\end_layout

\end_inset


\end_layout

\begin_deeper
\begin_layout LyX-Code
body
\end_layout

\begin_layout LyX-Code
   p "Some text with " text
\end_layout

\begin_layout LyX-Code
       bold "bold" text oswap add
\end_layout

\begin_layout LyX-Code
       " markup" text
\end_layout

\begin_layout LyX-Code
   oswap add
\end_layout

\begin_layout LyX-Code
   li
\end_layout

\begin_layout LyX-Code
       ul "a bullet point" text oswap add
\end_layout

\begin_layout LyX-Code
       ul "another bullet point" text oswap add
\end_layout

\begin_layout LyX-Code
   oswap add
\end_layout

\begin_layout LyX-Code
oswap add
\end_layout

\end_deeper
\begin_layout EndFrame

\end_layout

\begin_layout Section*
\start_of_appendix
Appendix
\end_layout

\begin_layout Subsection*
Literature&Links
\end_layout

\begin_layout BeginFrame
Literature&Links
\end_layout

\begin_layout Bibliography
\labelwidthstring Literaturverzeichnis
\begin_inset CommandInset bibitem
LatexCommand bibitem
key "net2o"

\end_inset


\noun on
Bernd Paysan
\noun default
 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
newblock
\end_layout

\end_inset


\emph on
\color white
net2o fossil repository
\emph default
\color inherit

\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
newblock
\end_layout

\end_inset

 
\begin_inset Flex URL
status open

\begin_layout Plain Layout

http://fossil.net2o.de/net2o/
\end_layout

\end_inset


\end_layout

\begin_layout EndFrame

\end_layout

\end_body
\end_document