WireProto/docs/README.html
2024-07-07 23:33:21 -04:00

2382 lines
116 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Asciidoctor 2.0.23">
<meta name="author" content="Brent Saner">
<title>WireProto Specification</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700">
<style>
/*! Asciidoctor default stylesheet | MIT License | https://asciidoctor.org */
/* Uncomment the following line when using as a custom stylesheet */
/* @import "https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700"; */
html{font-family:sans-serif;-webkit-text-size-adjust:100%}
a{background:none}
a:focus{outline:thin dotted}
a:active,a:hover{outline:0}
h1{font-size:2em;margin:.67em 0}
b,strong{font-weight:bold}
abbr{font-size:.9em}
abbr[title]{cursor:help;border-bottom:1px dotted #dddddf;text-decoration:none}
dfn{font-style:italic}
hr{height:0}
mark{background:#ff0;color:#000}
code,kbd,pre,samp{font-family:monospace;font-size:1em}
pre{white-space:pre-wrap}
q{quotes:"\201C" "\201D" "\2018" "\2019"}
small{font-size:80%}
sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}
sup{top:-.5em}
sub{bottom:-.25em}
img{border:0}
svg:not(:root){overflow:hidden}
figure{margin:0}
audio,video{display:inline-block}
audio:not([controls]){display:none;height:0}
fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}
legend{border:0;padding:0}
button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}
button,input{line-height:normal}
button,select{text-transform:none}
button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}
button[disabled],html input[disabled]{cursor:default}
input[type=checkbox],input[type=radio]{padding:0}
button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}
textarea{overflow:auto;vertical-align:top}
table{border-collapse:collapse;border-spacing:0}
*,::before,::after{box-sizing:border-box}
html,body{font-size:100%}
body{background:#fff;color:rgba(0,0,0,.8);padding:0;margin:0;font-family:"Noto Serif","DejaVu Serif",serif;line-height:1;position:relative;cursor:auto;-moz-tab-size:4;-o-tab-size:4;tab-size:4;word-wrap:anywhere;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}
a:hover{cursor:pointer}
img,object,embed{max-width:100%;height:auto}
object,embed{height:100%}
img{-ms-interpolation-mode:bicubic}
.left{float:left!important}
.right{float:right!important}
.text-left{text-align:left!important}
.text-right{text-align:right!important}
.text-center{text-align:center!important}
.text-justify{text-align:justify!important}
.hide{display:none}
img,object,svg{display:inline-block;vertical-align:middle}
textarea{height:auto;min-height:50px}
select{width:100%}
.subheader,.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{line-height:1.45;color:#7a2518;font-weight:400;margin-top:0;margin-bottom:.25em}
div,dl,dt,dd,ul,ol,li,h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6,pre,form,p,blockquote,th,td{margin:0;padding:0}
a{color:#2156a5;text-decoration:underline;line-height:inherit}
a:hover,a:focus{color:#1d4b8f}
a img{border:0}
p{line-height:1.6;margin-bottom:1.25em;text-rendering:optimizeLegibility}
p aside{font-size:.875em;line-height:1.35;font-style:italic}
h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{font-family:"Open Sans","DejaVu Sans",sans-serif;font-weight:300;font-style:normal;color:#ba3925;text-rendering:optimizeLegibility;margin-top:1em;margin-bottom:.5em;line-height:1.0125em}
h1 small,h2 small,h3 small,#toctitle small,.sidebarblock>.content>.title small,h4 small,h5 small,h6 small{font-size:60%;color:#e99b8f;line-height:0}
h1{font-size:2.125em}
h2{font-size:1.6875em}
h3,#toctitle,.sidebarblock>.content>.title{font-size:1.375em}
h4,h5{font-size:1.125em}
h6{font-size:1em}
hr{border:solid #dddddf;border-width:1px 0 0;clear:both;margin:1.25em 0 1.1875em}
em,i{font-style:italic;line-height:inherit}
strong,b{font-weight:bold;line-height:inherit}
small{font-size:60%;line-height:inherit}
code{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;font-weight:400;color:rgba(0,0,0,.9)}
ul,ol,dl{line-height:1.6;margin-bottom:1.25em;list-style-position:outside;font-family:inherit}
ul,ol{margin-left:1.5em}
ul li ul,ul li ol{margin-left:1.25em;margin-bottom:0}
ul.circle{list-style-type:circle}
ul.disc{list-style-type:disc}
ul.square{list-style-type:square}
ul.circle ul:not([class]),ul.disc ul:not([class]),ul.square ul:not([class]){list-style:inherit}
ol li ul,ol li ol{margin-left:1.25em;margin-bottom:0}
dl dt{margin-bottom:.3125em;font-weight:bold}
dl dd{margin-bottom:1.25em}
blockquote{margin:0 0 1.25em;padding:.5625em 1.25em 0 1.1875em;border-left:1px solid #ddd}
blockquote,blockquote p{line-height:1.6;color:rgba(0,0,0,.85)}
@media screen and (min-width:768px){h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2}
h1{font-size:2.75em}
h2{font-size:2.3125em}
h3,#toctitle,.sidebarblock>.content>.title{font-size:1.6875em}
h4{font-size:1.4375em}}
table{background:#fff;margin-bottom:1.25em;border:1px solid #dedede;word-wrap:normal}
table thead,table tfoot{background:#f7f8f7}
table thead tr th,table thead tr td,table tfoot tr th,table tfoot tr td{padding:.5em .625em .625em;font-size:inherit;color:rgba(0,0,0,.8);text-align:left}
table tr th,table tr td{padding:.5625em .625em;font-size:inherit;color:rgba(0,0,0,.8)}
table tr.even,table tr.alt{background:#f8f8f7}
table thead tr th,table tfoot tr th,table tbody tr td,table tr td,table tfoot tr td{line-height:1.6}
h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2;word-spacing:-.05em}
h1 strong,h2 strong,h3 strong,#toctitle strong,.sidebarblock>.content>.title strong,h4 strong,h5 strong,h6 strong{font-weight:400}
.center{margin-left:auto;margin-right:auto}
.stretch{width:100%}
.clearfix::before,.clearfix::after,.float-group::before,.float-group::after{content:" ";display:table}
.clearfix::after,.float-group::after{clear:both}
:not(pre).nobreak{word-wrap:normal}
:not(pre).nowrap{white-space:nowrap}
:not(pre).pre-wrap{white-space:pre-wrap}
:not(pre):not([class^=L])>code{font-size:.9375em;font-style:normal!important;letter-spacing:0;padding:.1em .5ex;word-spacing:-.15em;background:#f7f7f8;border-radius:4px;line-height:1.45;text-rendering:optimizeSpeed}
pre{color:rgba(0,0,0,.9);font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;line-height:1.45;text-rendering:optimizeSpeed}
pre code,pre pre{color:inherit;font-size:inherit;line-height:inherit}
pre>code{display:block}
pre.nowrap,pre.nowrap pre{white-space:pre;word-wrap:normal}
em em{font-style:normal}
strong strong{font-weight:400}
.keyseq{color:rgba(51,51,51,.8)}
kbd{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;display:inline-block;color:rgba(0,0,0,.8);font-size:.65em;line-height:1.45;background:#f7f7f7;border:1px solid #ccc;border-radius:3px;box-shadow:0 1px 0 rgba(0,0,0,.2),inset 0 0 0 .1em #fff;margin:0 .15em;padding:.2em .5em;vertical-align:middle;position:relative;top:-.1em;white-space:nowrap}
.keyseq kbd:first-child{margin-left:0}
.keyseq kbd:last-child{margin-right:0}
.menuseq,.menuref{color:#000}
.menuseq b:not(.caret),.menuref{font-weight:inherit}
.menuseq{word-spacing:-.02em}
.menuseq b.caret{font-size:1.25em;line-height:.8}
.menuseq i.caret{font-weight:bold;text-align:center;width:.45em}
b.button::before,b.button::after{position:relative;top:-1px;font-weight:400}
b.button::before{content:"[";padding:0 3px 0 2px}
b.button::after{content:"]";padding:0 2px 0 3px}
p a>code:hover{color:rgba(0,0,0,.9)}
#header,#content,#footnotes,#footer{width:100%;margin:0 auto;max-width:62.5em;*zoom:1;position:relative;padding-left:.9375em;padding-right:.9375em}
#header::before,#header::after,#content::before,#content::after,#footnotes::before,#footnotes::after,#footer::before,#footer::after{content:" ";display:table}
#header::after,#content::after,#footnotes::after,#footer::after{clear:both}
#content{margin-top:1.25em}
#content::before{content:none}
#header>h1:first-child{color:rgba(0,0,0,.85);margin-top:2.25rem;margin-bottom:0}
#header>h1:first-child+#toc{margin-top:8px;border-top:1px solid #dddddf}
#header>h1:only-child{border-bottom:1px solid #dddddf;padding-bottom:8px}
#header .details{border-bottom:1px solid #dddddf;line-height:1.45;padding-top:.25em;padding-bottom:.25em;padding-left:.25em;color:rgba(0,0,0,.6);display:flex;flex-flow:row wrap}
#header .details span:first-child{margin-left:-.125em}
#header .details span.email a{color:rgba(0,0,0,.85)}
#header .details br{display:none}
#header .details br+span::before{content:"\00a0\2013\00a0"}
#header .details br+span.author::before{content:"\00a0\22c5\00a0";color:rgba(0,0,0,.85)}
#header .details br+span#revremark::before{content:"\00a0|\00a0"}
#header #revnumber{text-transform:capitalize}
#header #revnumber::after{content:"\00a0"}
#content>h1:first-child:not([class]){color:rgba(0,0,0,.85);border-bottom:1px solid #dddddf;padding-bottom:8px;margin-top:0;padding-top:1rem;margin-bottom:1.25rem}
#toc{border-bottom:1px solid #e7e7e9;padding-bottom:.5em}
#toc>ul{margin-left:.125em}
#toc ul.sectlevel0>li>a{font-style:italic}
#toc ul.sectlevel0 ul.sectlevel1{margin:.5em 0}
#toc ul{font-family:"Open Sans","DejaVu Sans",sans-serif;list-style-type:none}
#toc li{line-height:1.3334;margin-top:.3334em}
#toc a{text-decoration:none}
#toc a:active{text-decoration:underline}
#toctitle{color:#7a2518;font-size:1.2em}
@media screen and (min-width:768px){#toctitle{font-size:1.375em}
body.toc2{padding-left:15em;padding-right:0}
body.toc2 #header>h1:nth-last-child(2){border-bottom:1px solid #dddddf;padding-bottom:8px}
#toc.toc2{margin-top:0!important;background:#f8f8f7;position:fixed;width:15em;left:0;top:0;border-right:1px solid #e7e7e9;border-top-width:0!important;border-bottom-width:0!important;z-index:1000;padding:1.25em 1em;height:100%;overflow:auto}
#toc.toc2 #toctitle{margin-top:0;margin-bottom:.8rem;font-size:1.2em}
#toc.toc2>ul{font-size:.9em;margin-bottom:0}
#toc.toc2 ul ul{margin-left:0;padding-left:1em}
#toc.toc2 ul.sectlevel0 ul.sectlevel1{padding-left:0;margin-top:.5em;margin-bottom:.5em}
body.toc2.toc-right{padding-left:0;padding-right:15em}
body.toc2.toc-right #toc.toc2{border-right-width:0;border-left:1px solid #e7e7e9;left:auto;right:0}}
@media screen and (min-width:1280px){body.toc2{padding-left:20em;padding-right:0}
#toc.toc2{width:20em}
#toc.toc2 #toctitle{font-size:1.375em}
#toc.toc2>ul{font-size:.95em}
#toc.toc2 ul ul{padding-left:1.25em}
body.toc2.toc-right{padding-left:0;padding-right:20em}}
#content #toc{border:1px solid #e0e0dc;margin-bottom:1.25em;padding:1.25em;background:#f8f8f7;border-radius:4px}
#content #toc>:first-child{margin-top:0}
#content #toc>:last-child{margin-bottom:0}
#footer{max-width:none;background:rgba(0,0,0,.8);padding:1.25em}
#footer-text{color:hsla(0,0%,100%,.8);line-height:1.44}
#content{margin-bottom:.625em}
.sect1{padding-bottom:.625em}
@media screen and (min-width:768px){#content{margin-bottom:1.25em}
.sect1{padding-bottom:1.25em}}
.sect1:last-child{padding-bottom:0}
.sect1+.sect1{border-top:1px solid #e7e7e9}
#content h1>a.anchor,h2>a.anchor,h3>a.anchor,#toctitle>a.anchor,.sidebarblock>.content>.title>a.anchor,h4>a.anchor,h5>a.anchor,h6>a.anchor{position:absolute;z-index:1001;width:1.5ex;margin-left:-1.5ex;display:block;text-decoration:none!important;visibility:hidden;text-align:center;font-weight:400}
#content h1>a.anchor::before,h2>a.anchor::before,h3>a.anchor::before,#toctitle>a.anchor::before,.sidebarblock>.content>.title>a.anchor::before,h4>a.anchor::before,h5>a.anchor::before,h6>a.anchor::before{content:"\00A7";font-size:.85em;display:block;padding-top:.1em}
#content h1:hover>a.anchor,#content h1>a.anchor:hover,h2:hover>a.anchor,h2>a.anchor:hover,h3:hover>a.anchor,#toctitle:hover>a.anchor,.sidebarblock>.content>.title:hover>a.anchor,h3>a.anchor:hover,#toctitle>a.anchor:hover,.sidebarblock>.content>.title>a.anchor:hover,h4:hover>a.anchor,h4>a.anchor:hover,h5:hover>a.anchor,h5>a.anchor:hover,h6:hover>a.anchor,h6>a.anchor:hover{visibility:visible}
#content h1>a.link,h2>a.link,h3>a.link,#toctitle>a.link,.sidebarblock>.content>.title>a.link,h4>a.link,h5>a.link,h6>a.link{color:#ba3925;text-decoration:none}
#content h1>a.link:hover,h2>a.link:hover,h3>a.link:hover,#toctitle>a.link:hover,.sidebarblock>.content>.title>a.link:hover,h4>a.link:hover,h5>a.link:hover,h6>a.link:hover{color:#a53221}
details,.audioblock,.imageblock,.literalblock,.listingblock,.stemblock,.videoblock{margin-bottom:1.25em}
details{margin-left:1.25rem}
details>summary{cursor:pointer;display:block;position:relative;line-height:1.6;margin-bottom:.625rem;outline:none;-webkit-tap-highlight-color:transparent}
details>summary::-webkit-details-marker{display:none}
details>summary::before{content:"";border:solid transparent;border-left:solid;border-width:.3em 0 .3em .5em;position:absolute;top:.5em;left:-1.25rem;transform:translateX(15%)}
details[open]>summary::before{border:solid transparent;border-top:solid;border-width:.5em .3em 0;transform:translateY(15%)}
details>summary::after{content:"";width:1.25rem;height:1em;position:absolute;top:.3em;left:-1.25rem}
.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{text-rendering:optimizeLegibility;text-align:left;font-family:"Noto Serif","DejaVu Serif",serif;font-size:1rem;font-style:italic}
table.tableblock.fit-content>caption.title{white-space:nowrap;width:0}
.paragraph.lead>p,#preamble>.sectionbody>[class=paragraph]:first-of-type p{font-size:1.21875em;line-height:1.6;color:rgba(0,0,0,.85)}
.admonitionblock>table{border-collapse:separate;border:0;background:none;width:100%}
.admonitionblock>table td.icon{text-align:center;width:80px}
.admonitionblock>table td.icon img{max-width:none}
.admonitionblock>table td.icon .title{font-weight:bold;font-family:"Open Sans","DejaVu Sans",sans-serif;text-transform:uppercase}
.admonitionblock>table td.content{padding-left:1.125em;padding-right:1.25em;border-left:1px solid #dddddf;color:rgba(0,0,0,.6);word-wrap:anywhere}
.admonitionblock>table td.content>:last-child>:last-child{margin-bottom:0}
.exampleblock>.content{border:1px solid #e6e6e6;margin-bottom:1.25em;padding:1.25em;background:#fff;border-radius:4px}
.sidebarblock{border:1px solid #dbdbd6;margin-bottom:1.25em;padding:1.25em;background:#f3f3f2;border-radius:4px}
.sidebarblock>.content>.title{color:#7a2518;margin-top:0;text-align:center}
.exampleblock>.content>:first-child,.sidebarblock>.content>:first-child{margin-top:0}
.exampleblock>.content>:last-child,.exampleblock>.content>:last-child>:last-child,.exampleblock>.content .olist>ol>li:last-child>:last-child,.exampleblock>.content .ulist>ul>li:last-child>:last-child,.exampleblock>.content .qlist>ol>li:last-child>:last-child,.sidebarblock>.content>:last-child,.sidebarblock>.content>:last-child>:last-child,.sidebarblock>.content .olist>ol>li:last-child>:last-child,.sidebarblock>.content .ulist>ul>li:last-child>:last-child,.sidebarblock>.content .qlist>ol>li:last-child>:last-child{margin-bottom:0}
.literalblock pre,.listingblock>.content>pre{border-radius:4px;overflow-x:auto;padding:1em;font-size:.8125em}
@media screen and (min-width:768px){.literalblock pre,.listingblock>.content>pre{font-size:.90625em}}
@media screen and (min-width:1280px){.literalblock pre,.listingblock>.content>pre{font-size:1em}}
.literalblock pre,.listingblock>.content>pre:not(.highlight),.listingblock>.content>pre[class=highlight],.listingblock>.content>pre[class^="highlight "]{background:#f7f7f8}
.literalblock.output pre{color:#f7f7f8;background:rgba(0,0,0,.9)}
.listingblock>.content{position:relative}
.listingblock code[data-lang]::before{display:none;content:attr(data-lang);position:absolute;font-size:.75em;top:.425rem;right:.5rem;line-height:1;text-transform:uppercase;color:inherit;opacity:.5}
.listingblock:hover code[data-lang]::before{display:block}
.listingblock.terminal pre .command::before{content:attr(data-prompt);padding-right:.5em;color:inherit;opacity:.5}
.listingblock.terminal pre .command:not([data-prompt])::before{content:"$"}
.listingblock pre.highlightjs{padding:0}
.listingblock pre.highlightjs>code{padding:1em;border-radius:4px}
.listingblock pre.prettyprint{border-width:0}
.prettyprint{background:#f7f7f8}
pre.prettyprint .linenums{line-height:1.45;margin-left:2em}
pre.prettyprint li{background:none;list-style-type:inherit;padding-left:0}
pre.prettyprint li code[data-lang]::before{opacity:1}
pre.prettyprint li:not(:first-child) code[data-lang]::before{display:none}
table.linenotable{border-collapse:separate;border:0;margin-bottom:0;background:none}
table.linenotable td[class]{color:inherit;vertical-align:top;padding:0;line-height:inherit;white-space:normal}
table.linenotable td.code{padding-left:.75em}
table.linenotable td.linenos,pre.pygments .linenos{border-right:1px solid;opacity:.35;padding-right:.5em;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}
pre.pygments span.linenos{display:inline-block;margin-right:.75em}
.quoteblock{margin:0 1em 1.25em 1.5em;display:table}
.quoteblock:not(.excerpt)>.title{margin-left:-1.5em;margin-bottom:.75em}
.quoteblock blockquote,.quoteblock p{color:rgba(0,0,0,.85);font-size:1.15rem;line-height:1.75;word-spacing:.1em;letter-spacing:0;font-style:italic;text-align:justify}
.quoteblock blockquote{margin:0;padding:0;border:0}
.quoteblock blockquote::before{content:"\201c";float:left;font-size:2.75em;font-weight:bold;line-height:.6em;margin-left:-.6em;color:#7a2518;text-shadow:0 1px 2px rgba(0,0,0,.1)}
.quoteblock blockquote>.paragraph:last-child p{margin-bottom:0}
.quoteblock .attribution{margin-top:.75em;margin-right:.5ex;text-align:right}
.verseblock{margin:0 1em 1.25em}
.verseblock pre{font-family:"Open Sans","DejaVu Sans",sans-serif;font-size:1.15rem;color:rgba(0,0,0,.85);font-weight:300;text-rendering:optimizeLegibility}
.verseblock pre strong{font-weight:400}
.verseblock .attribution{margin-top:1.25rem;margin-left:.5ex}
.quoteblock .attribution,.verseblock .attribution{font-size:.9375em;line-height:1.45;font-style:italic}
.quoteblock .attribution br,.verseblock .attribution br{display:none}
.quoteblock .attribution cite,.verseblock .attribution cite{display:block;letter-spacing:-.025em;color:rgba(0,0,0,.6)}
.quoteblock.abstract blockquote::before,.quoteblock.excerpt blockquote::before,.quoteblock .quoteblock blockquote::before{display:none}
.quoteblock.abstract blockquote,.quoteblock.abstract p,.quoteblock.excerpt blockquote,.quoteblock.excerpt p,.quoteblock .quoteblock blockquote,.quoteblock .quoteblock p{line-height:1.6;word-spacing:0}
.quoteblock.abstract{margin:0 1em 1.25em;display:block}
.quoteblock.abstract>.title{margin:0 0 .375em;font-size:1.15em;text-align:center}
.quoteblock.excerpt>blockquote,.quoteblock .quoteblock{padding:0 0 .25em 1em;border-left:.25em solid #dddddf}
.quoteblock.excerpt,.quoteblock .quoteblock{margin-left:0}
.quoteblock.excerpt blockquote,.quoteblock.excerpt p,.quoteblock .quoteblock blockquote,.quoteblock .quoteblock p{color:inherit;font-size:1.0625rem}
.quoteblock.excerpt .attribution,.quoteblock .quoteblock .attribution{color:inherit;font-size:.85rem;text-align:left;margin-right:0}
p.tableblock:last-child{margin-bottom:0}
td.tableblock>.content{margin-bottom:1.25em;word-wrap:anywhere}
td.tableblock>.content>:last-child{margin-bottom:-1.25em}
table.tableblock,th.tableblock,td.tableblock{border:0 solid #dedede}
table.grid-all>*>tr>*{border-width:1px}
table.grid-cols>*>tr>*{border-width:0 1px}
table.grid-rows>*>tr>*{border-width:1px 0}
table.frame-all{border-width:1px}
table.frame-ends{border-width:1px 0}
table.frame-sides{border-width:0 1px}
table.frame-none>colgroup+*>:first-child>*,table.frame-sides>colgroup+*>:first-child>*{border-top-width:0}
table.frame-none>:last-child>:last-child>*,table.frame-sides>:last-child>:last-child>*{border-bottom-width:0}
table.frame-none>*>tr>:first-child,table.frame-ends>*>tr>:first-child{border-left-width:0}
table.frame-none>*>tr>:last-child,table.frame-ends>*>tr>:last-child{border-right-width:0}
table.stripes-all>*>tr,table.stripes-odd>*>tr:nth-of-type(odd),table.stripes-even>*>tr:nth-of-type(even),table.stripes-hover>*>tr:hover{background:#f8f8f7}
th.halign-left,td.halign-left{text-align:left}
th.halign-right,td.halign-right{text-align:right}
th.halign-center,td.halign-center{text-align:center}
th.valign-top,td.valign-top{vertical-align:top}
th.valign-bottom,td.valign-bottom{vertical-align:bottom}
th.valign-middle,td.valign-middle{vertical-align:middle}
table thead th,table tfoot th{font-weight:bold}
tbody tr th{background:#f7f8f7}
tbody tr th,tbody tr th p,tfoot tr th,tfoot tr th p{color:rgba(0,0,0,.8);font-weight:bold}
p.tableblock>code:only-child{background:none;padding:0}
p.tableblock{font-size:1em}
ol{margin-left:1.75em}
ul li ol{margin-left:1.5em}
dl dd{margin-left:1.125em}
dl dd:last-child,dl dd:last-child>:last-child{margin-bottom:0}
li p,ul dd,ol dd,.olist .olist,.ulist .ulist,.ulist .olist,.olist .ulist{margin-bottom:.625em}
ul.checklist,ul.none,ol.none,ul.no-bullet,ol.no-bullet,ol.unnumbered,ul.unstyled,ol.unstyled{list-style-type:none}
ul.no-bullet,ol.no-bullet,ol.unnumbered{margin-left:.625em}
ul.unstyled,ol.unstyled{margin-left:0}
li>p:empty:only-child::before{content:"";display:inline-block}
ul.checklist>li>p:first-child{margin-left:-1em}
ul.checklist>li>p:first-child>.fa-square-o:first-child,ul.checklist>li>p:first-child>.fa-check-square-o:first-child{width:1.25em;font-size:.8em;position:relative;bottom:.125em}
ul.checklist>li>p:first-child>input[type=checkbox]:first-child{margin-right:.25em}
ul.inline{display:flex;flex-flow:row wrap;list-style:none;margin:0 0 .625em -1.25em}
ul.inline>li{margin-left:1.25em}
.unstyled dl dt{font-weight:400;font-style:normal}
ol.arabic{list-style-type:decimal}
ol.decimal{list-style-type:decimal-leading-zero}
ol.loweralpha{list-style-type:lower-alpha}
ol.upperalpha{list-style-type:upper-alpha}
ol.lowerroman{list-style-type:lower-roman}
ol.upperroman{list-style-type:upper-roman}
ol.lowergreek{list-style-type:lower-greek}
.hdlist>table,.colist>table{border:0;background:none}
.hdlist>table>tbody>tr,.colist>table>tbody>tr{background:none}
td.hdlist1,td.hdlist2{vertical-align:top;padding:0 .625em}
td.hdlist1{font-weight:bold;padding-bottom:1.25em}
td.hdlist2{word-wrap:anywhere}
.literalblock+.colist,.listingblock+.colist{margin-top:-.5em}
.colist td:not([class]):first-child{padding:.4em .75em 0;line-height:1;vertical-align:top}
.colist td:not([class]):first-child img{max-width:none}
.colist td:not([class]):last-child{padding:.25em 0}
.thumb,.th{line-height:0;display:inline-block;border:4px solid #fff;box-shadow:0 0 0 1px #ddd}
.imageblock.left{margin:.25em .625em 1.25em 0}
.imageblock.right{margin:.25em 0 1.25em .625em}
.imageblock>.title{margin-bottom:0}
.imageblock.thumb,.imageblock.th{border-width:6px}
.imageblock.thumb>.title,.imageblock.th>.title{padding:0 .125em}
.image.left,.image.right{margin-top:.25em;margin-bottom:.25em;display:inline-block;line-height:0}
.image.left{margin-right:.625em}
.image.right{margin-left:.625em}
a.image{text-decoration:none;display:inline-block}
a.image object{pointer-events:none}
sup.footnote,sup.footnoteref{font-size:.875em;position:static;vertical-align:super}
sup.footnote a,sup.footnoteref a{text-decoration:none}
sup.footnote a:active,sup.footnoteref a:active,#footnotes .footnote a:first-of-type:active{text-decoration:underline}
#footnotes{padding-top:.75em;padding-bottom:.75em;margin-bottom:.625em}
#footnotes hr{width:20%;min-width:6.25em;margin:-.25em 0 .75em;border-width:1px 0 0}
#footnotes .footnote{padding:0 .375em 0 .225em;line-height:1.3334;font-size:.875em;margin-left:1.2em;margin-bottom:.2em}
#footnotes .footnote a:first-of-type{font-weight:bold;text-decoration:none;margin-left:-1.05em}
#footnotes .footnote:last-of-type{margin-bottom:0}
#content #footnotes{margin-top:-.625em;margin-bottom:0;padding:.75em 0}
div.unbreakable{page-break-inside:avoid}
.big{font-size:larger}
.small{font-size:smaller}
.underline{text-decoration:underline}
.overline{text-decoration:overline}
.line-through{text-decoration:line-through}
.aqua{color:#00bfbf}
.aqua-background{background:#00fafa}
.black{color:#000}
.black-background{background:#000}
.blue{color:#0000bf}
.blue-background{background:#0000fa}
.fuchsia{color:#bf00bf}
.fuchsia-background{background:#fa00fa}
.gray{color:#606060}
.gray-background{background:#7d7d7d}
.green{color:#006000}
.green-background{background:#007d00}
.lime{color:#00bf00}
.lime-background{background:#00fa00}
.maroon{color:#600000}
.maroon-background{background:#7d0000}
.navy{color:#000060}
.navy-background{background:#00007d}
.olive{color:#606000}
.olive-background{background:#7d7d00}
.purple{color:#600060}
.purple-background{background:#7d007d}
.red{color:#bf0000}
.red-background{background:#fa0000}
.silver{color:#909090}
.silver-background{background:#bcbcbc}
.teal{color:#006060}
.teal-background{background:#007d7d}
.white{color:#bfbfbf}
.white-background{background:#fafafa}
.yellow{color:#bfbf00}
.yellow-background{background:#fafa00}
span.icon>.fa{cursor:default}
a span.icon>.fa{cursor:inherit}
.admonitionblock td.icon [class^="fa icon-"]{font-size:2.5em;text-shadow:1px 1px 2px rgba(0,0,0,.5);cursor:default}
.admonitionblock td.icon .icon-note::before{content:"\f05a";color:#19407c}
.admonitionblock td.icon .icon-tip::before{content:"\f0eb";text-shadow:1px 1px 2px rgba(155,155,0,.8);color:#111}
.admonitionblock td.icon .icon-warning::before{content:"\f071";color:#bf6900}
.admonitionblock td.icon .icon-caution::before{content:"\f06d";color:#bf3400}
.admonitionblock td.icon .icon-important::before{content:"\f06a";color:#bf0000}
.conum[data-value]{display:inline-block;color:#fff!important;background:rgba(0,0,0,.8);border-radius:50%;text-align:center;font-size:.75em;width:1.67em;height:1.67em;line-height:1.67em;font-family:"Open Sans","DejaVu Sans",sans-serif;font-style:normal;font-weight:bold}
.conum[data-value] *{color:#fff!important}
.conum[data-value]+b{display:none}
.conum[data-value]::after{content:attr(data-value)}
pre .conum[data-value]{position:relative;top:-.125em}
b.conum *{color:inherit!important}
.conum:not([data-value]):empty{display:none}
dt,th.tableblock,td.content,div.footnote{text-rendering:optimizeLegibility}
h1,h2,p,td.content,span.alt,summary{letter-spacing:-.01em}
p strong,td.content strong,div.footnote strong{letter-spacing:-.005em}
p,blockquote,dt,td.content,td.hdlist1,span.alt,summary{font-size:1.0625rem}
p{margin-bottom:1.25rem}
.sidebarblock p,.sidebarblock dt,.sidebarblock td.content,p.tableblock{font-size:1em}
.exampleblock>.content{background:#fffef7;border-color:#e0e0dc;box-shadow:0 1px 4px #e0e0dc}
.print-only{display:none!important}
@page{margin:1.25cm .75cm}
@media print{*{box-shadow:none!important;text-shadow:none!important}
html{font-size:80%}
a{color:inherit!important;text-decoration:underline!important}
a.bare,a[href^="#"],a[href^="mailto:"]{text-decoration:none!important}
a[href^="http:"]:not(.bare)::after,a[href^="https:"]:not(.bare)::after{content:"(" attr(href) ")";display:inline-block;font-size:.875em;padding-left:.25em}
abbr[title]{border-bottom:1px dotted}
abbr[title]::after{content:" (" attr(title) ")"}
pre,blockquote,tr,img,object,svg{page-break-inside:avoid}
thead{display:table-header-group}
svg{max-width:100%}
p,blockquote,dt,td.content{font-size:1em;orphans:3;widows:3}
h2,h3,#toctitle,.sidebarblock>.content>.title{page-break-after:avoid}
#header,#content,#footnotes,#footer{max-width:none}
#toc,.sidebarblock,.exampleblock>.content{background:none!important}
#toc{border-bottom:1px solid #dddddf!important;padding-bottom:0!important}
body.book #header{text-align:center}
body.book #header>h1:first-child{border:0!important;margin:2.5em 0 1em}
body.book #header .details{border:0!important;display:block;padding:0!important}
body.book #header .details span:first-child{margin-left:0!important}
body.book #header .details br{display:block}
body.book #header .details br+span::before{content:none!important}
body.book #toc{border:0!important;text-align:left!important;padding:0!important;margin:0!important}
body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-break-before:always}
.listingblock code[data-lang]::before{display:block}
#footer{padding:0 .9375em}
.hide-on-print{display:none!important}
.print-only{display:block!important}
.hide-for-print{display:none!important}
.show-for-print{display:inherit!important}}
@media amzn-kf8,print{#header>h1:first-child{margin-top:1.25rem}
.sect1{padding:0!important}
.sect1+.sect1{border:0}
#footer{background:none}
#footer-text{color:rgba(0,0,0,.6);font-size:.9em}}
@media amzn-kf8{#header,#content,#footnotes,#footer{padding:0}}
</style>
<style>
pre.rouge table td { padding: 5px; }
pre.rouge table pre { margin: 0; }
pre.rouge, pre.rouge .w {
color: #24292f;
background-color: #f6f8fa;
}
pre.rouge .k, pre.rouge .kd, pre.rouge .kn, pre.rouge .kp, pre.rouge .kr, pre.rouge .kt, pre.rouge .kv {
color: #cf222e;
}
pre.rouge .gr {
color: #f6f8fa;
}
pre.rouge .gd {
color: #82071e;
background-color: #ffebe9;
}
pre.rouge .nb {
color: #953800;
}
pre.rouge .nc {
color: #953800;
}
pre.rouge .no {
color: #953800;
}
pre.rouge .nn {
color: #953800;
}
pre.rouge .sr {
color: #116329;
}
pre.rouge .na {
color: #116329;
}
pre.rouge .nt {
color: #116329;
}
pre.rouge .gi {
color: #116329;
background-color: #dafbe1;
}
pre.rouge .kc {
color: #0550ae;
}
pre.rouge .l, pre.rouge .ld, pre.rouge .m, pre.rouge .mb, pre.rouge .mf, pre.rouge .mh, pre.rouge .mi, pre.rouge .il, pre.rouge .mo, pre.rouge .mx {
color: #0550ae;
}
pre.rouge .sb {
color: #0550ae;
}
pre.rouge .bp {
color: #0550ae;
}
pre.rouge .ne {
color: #0550ae;
}
pre.rouge .nl {
color: #0550ae;
}
pre.rouge .py {
color: #0550ae;
}
pre.rouge .nv, pre.rouge .vc, pre.rouge .vg, pre.rouge .vi, pre.rouge .vm {
color: #0550ae;
}
pre.rouge .o, pre.rouge .ow {
color: #0550ae;
}
pre.rouge .gh {
color: #0550ae;
font-weight: bold;
}
pre.rouge .gu {
color: #0550ae;
font-weight: bold;
}
pre.rouge .s, pre.rouge .sa, pre.rouge .sc, pre.rouge .dl, pre.rouge .sd, pre.rouge .s2, pre.rouge .se, pre.rouge .sh, pre.rouge .sx, pre.rouge .s1, pre.rouge .ss {
color: #0a3069;
}
pre.rouge .nd {
color: #8250df;
}
pre.rouge .nf, pre.rouge .fm {
color: #8250df;
}
pre.rouge .err {
color: #f6f8fa;
background-color: #82071e;
}
pre.rouge .c, pre.rouge .ch, pre.rouge .cd, pre.rouge .cm, pre.rouge .cp, pre.rouge .cpf, pre.rouge .c1, pre.rouge .cs {
color: #6e7781;
}
pre.rouge .gl {
color: #6e7781;
}
pre.rouge .gt {
color: #6e7781;
}
pre.rouge .ni {
color: #24292f;
}
pre.rouge .si {
color: #24292f;
}
pre.rouge .ge {
color: #24292f;
font-style: italic;
}
pre.rouge .gs {
color: #24292f;
font-weight: bold;
}
</style>
<!-- https://stackoverflow.com/a/34481639 -->
<!-- Generate a nice TOC -->
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.tocify/1.9.0/javascripts/jquery.tocify.min.js"></script>
<!-- We do not need the tocify CSS because the asciidoc CSS already provides most of what we neeed -->
<style>
.tocify-header {
font-style: italic;
}
.tocify-subheader {
font-style: normal;
font-size: 90%;
}
.tocify ul {
margin: 0;
}
.tocify-focus {
color: #7a2518;
background-color: rgba(0, 0, 0, 0.1);
}
.tocify-focus > a {
color: #7a2518;
}
</style>
<script type="text/javascript">
$(function () {
// Add a new container for the tocify toc into the existing toc so we can re-use its
// styling
$("#toc").append("<div id='generated-toc'></div>");
$("#generated-toc").tocify({
extendPage: true,
context: "#content",
highlightOnScroll: true,
hideEffect: "slideUp",
// Use the IDs that asciidoc already provides so that TOC links and intra-document
// links are the same. Anything else might confuse users when they create bookmarks.
hashGenerator: function(text, element) {
return $(element).attr("id");
},
// Smooth scrolling doesn't work properly if we use the asciidoc IDs
smoothScroll: false,
// Set to 'none' to use the tocify classes
theme: "none",
// Handle book (may contain h1) and article (only h2 deeper)
selectors: $( "#content" ).has( "h1" ).size() > 0 ? "h1,h2,h3,h4,h5" : "h2,h3,h4,h5",
ignoreSelector: ".discrete"
});
// Switch between static asciidoc toc and dynamic tocify toc based on browser size
// This is set to match the media selectors in the asciidoc CSS
// Without this, we keep the dynamic toc even if it is moved from the side to preamble
// position which will cause odd scrolling behavior
var handleTocOnResize = function() {
if ($(document).width() < 768) {
$("#generated-toc").hide();
$(".sectlevel0").show();
$(".sectlevel1").show();
}
else {
$("#generated-toc").show();
$(".sectlevel0").hide();
$(".sectlevel1").hide();
}
}
$(window).resize(handleTocOnResize);
handleTocOnResize();
});
</script>
</head>
<body class="book toc2 toc-left">
<div id="header">
<h1>WireProto Specification</h1>
<div class="details">
<span id="author" class="author">Brent Saner</span><br>
<span id="email" class="email"><a href="mailto:bts@square-r00t.net">bts@square-r00t.net</a></span><br>
<span id="revdate">Last rendered 2024-07-07 23:33:25 -0400</span>
</div>
<div id="toc" class="toc2">
<div id="toctitle">Table of Contents</div>
<ul class="sectlevel1">
<li><a href="#license">1. License</a></li>
<li><a href="#proto">2. Protocol</a>
<ul class="sectlevel2">
<li><a href="#lib">2.1. Library</a></li>
<li><a href="#ytho">2.2. Why a Custom Message Format?</a></li>
</ul>
</li>
<li><a href="#msg">3. Message Format</a>
<ul class="sectlevel2">
<li><a href="#msg_respstatus">3.1. Response Status</a></li>
<li><a href="#proto_ver">3.2. Protocol Version</a></li>
<li><a href="#msg_grp">3.3. Record Group</a>
<ul class="sectlevel3">
<li><a href="#msg_grp_rec">3.3.1. Record</a>
<ul class="sectlevel4">
<li><a href="#msg_grp_rec_kv">3.3.1.1. Field/Value Pair (Key/Value Pair)</a>
<ul class="sectlevel5">
<li><a href="#msg_grp_rec_kv_nm">3.3.1.1.1. Field Name</a></li>
<li><a href="#msg_grp_rec_kv_val">3.3.1.1.2. Field Value</a></li>
</ul>
</li>
<li><a href="#msg_grp_recresp">3.3.1.2. Copy Record (Response Copy of Request)</a>
<ul class="sectlevel5">
<li><a href="#msg_grp_rec_kvcpy">3.3.1.2.1. Field/Value Pair (Key/Value Pair) (Response Copy)</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li><a href="#cksum">4. Checksums</a></li>
<li><a href="#hdrs">5. Headers</a>
<ul class="sectlevel2">
<li><a href="#hdrs_respstart">5.1. <code>RESPSTART</code> Byte Sequence</a></li>
<li><a href="#hdrs_cksum">5.2. <code>CKSUM</code> Header Prefix</a></li>
<li><a href="#hdrs_msgstart">5.3. <code>MSGSTART</code> Header Prefix</a></li>
<li><a href="#hdrs_bodystart">5.4. <code>BODYSTART</code> Header Prefix</a></li>
<li><a href="#hdrs_bodyend">5.5. <code>BODYEND</code> Sequence</a></li>
<li><a href="#hdrs_msgend">5.6. <code>MSGEND</code> Sequence</a></li>
</ul>
</li>
<li><a href="#alloc">6. Allocators</a>
<ul class="sectlevel2">
<li><a href="#alloc_cnt">6.1. Count Allocator</a></li>
<li><a href="#alloc_size">6.2. Size Allocator</a></li>
</ul>
</li>
<li><a href="#ref">7. Reference Model and Examples</a>
<ul class="sectlevel2">
<li><a href="#ref_single">7.1. Single/Simple</a>
<ul class="sectlevel3">
<li><a href="#ref_single_req">7.1.1. Single/Simple Request</a></li>
<li><a href="#ref_single_resp">7.1.2. Single/Simple Response</a></li>
</ul>
</li>
<li><a href="#ref_multi">7.2. Multiple/Many/Complex</a>
<ul class="sectlevel3">
<li><a href="#ref_multi_req">7.2.1. Complex Request</a></li>
<li><a href="#ref_multi_resp">7.2.2. Complex Response</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div id="content">
<div class="sect1">
<h2 id="license"><a class="link" href="#license">1. License</a></h2>
<div class="sectionbody">
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>WireProto Specification License</title>
<!-- <link rel="stylesheet" href="style.css"> -->
<!-- <script src="script.js"></script> -->
</head>
<body>
<p>
<a property="dct:title"
rel="cc:attributionURL"
href="https://wireproto.io">
WireProto Specification
</a> by
<a rel="cc:attributionURL dct:creator"
property="cc:attributionName"
href="https://r00t2.io">
Brent Saner
</a> is licensed under
<a href="https://creativecommons.org/licenses/by-sa/4.0/?ref=chooser-v1"
target="_blank"
rel="license noopener noreferrer"
style="display:inline-block;">
Creative Commons Attribution-ShareAlike 4.0 International
<br />
<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;"
src="https://mirrors.creativecommons.org/presskit/icons/cc.svg?ref=chooser-v1"
alt="">
<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;"
src="https://mirrors.creativecommons.org/presskit/icons/by.svg?ref=chooser-v1"
alt="">
<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;"
src="https://mirrors.creativecommons.org/presskit/icons/sa.svg?ref=chooser-v1"
alt=""></a>
</p>
<p>
<details>
<summary>(License in full)</summary>
<pre>
Attribution-ShareAlike 4.0 International
=======================================================================
Creative Commons Corporation ("Creative Commons") is not a law firm and
does not provide legal services or legal advice. Distribution of
Creative Commons public licenses does not create a lawyer-client or
other relationship. Creative Commons makes its licenses and related
information available on an "as-is" basis. Creative Commons gives no
warranties regarding its licenses, any material licensed under their
terms and conditions, or any related information. Creative Commons
disclaims all liability for damages resulting from their use to the
fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and
conditions that creators and other rights holders may use to share
original works of authorship and other material subject to copyright
and certain other rights specified in the public license below. The
following considerations are for informational purposes only, are not
exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are
intended for use by those authorized to give the public
permission to use material in ways otherwise restricted by
copyright and certain other rights. Our licenses are
irrevocable. Licensors should read and understand the terms
and conditions of the license they choose before applying it.
Licensors should also secure all rights necessary before
applying our licenses so that the public can reuse the
material as expected. Licensors should clearly mark any
material not subject to the license. This includes other CC-
licensed material, or material used under an exception or
limitation to copyright. More considerations for licensors:
wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public
licenses, a licensor grants the public permission to use the
licensed material under specified terms and conditions. If
the licensor's permission is not necessary for any reason--for
example, because of any applicable exception or limitation to
copyright--then that use is not regulated by the license. Our
licenses grant only permissions under copyright and certain
other rights that a licensor has authority to grant. Use of
the licensed material may still be restricted for other
reasons, including because others have copyright or other
rights in the material. A licensor may make special requests,
such as asking that all changes be marked or described.
Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More considerations
for the public:
wiki.creativecommons.org/Considerations_for_licensees
=======================================================================
Creative Commons Attribution-ShareAlike 4.0 International Public
License
By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution-ShareAlike 4.0 International Public License ("Public
License"). To the extent this Public License may be interpreted as a
contract, You are granted the Licensed Rights in consideration of Your
acceptance of these terms and conditions, and the Licensor grants You
such rights in consideration of benefits the Licensor receives from
making the Licensed Material available under these terms and
conditions.
Section 1 -- Definitions.
a. Adapted Material means material subject to Copyright and Similar
Rights that is derived from or based upon the Licensed Material
and in which the Licensed Material is translated, altered,
arranged, transformed, or otherwise modified in a manner requiring
permission under the Copyright and Similar Rights held by the
Licensor. For purposes of this Public License, where the Licensed
Material is a musical work, performance, or sound recording,
Adapted Material is always produced where the Licensed Material is
synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright
and Similar Rights in Your contributions to Adapted Material in
accordance with the terms and conditions of this Public License.
c. BY-SA Compatible License means a license listed at
creativecommons.org/compatiblelicenses, approved by Creative
Commons as essentially the equivalent of this Public License.
d. Copyright and Similar Rights means copyright and/or similar rights
closely related to copyright including, without limitation,
performance, broadcast, sound recording, and Sui Generis Database
Rights, without regard to how the rights are labeled or
categorized. For purposes of this Public License, the rights
specified in Section 2(b)(1)-(2) are not Copyright and Similar
Rights.
e. Effective Technological Measures means those measures that, in the
absence of proper authority, may not be circumvented under laws
fulfilling obligations under Article 11 of the WIPO Copyright
Treaty adopted on December 20, 1996, and/or similar international
agreements.
f. Exceptions and Limitations means fair use, fair dealing, and/or
any other exception or limitation to Copyright and Similar Rights
that applies to Your use of the Licensed Material.
g. License Elements means the license attributes listed in the name
of a Creative Commons Public License. The License Elements of this
Public License are Attribution and ShareAlike.
h. Licensed Material means the artistic or literary work, database,
or other material to which the Licensor applied this Public
License.
i. Licensed Rights means the rights granted to You subject to the
terms and conditions of this Public License, which are limited to
all Copyright and Similar Rights that apply to Your use of the
Licensed Material and that the Licensor has authority to license.
j. Licensor means the individual(s) or entity(ies) granting rights
under this Public License.
k. Share means to provide material to the public by any means or
process that requires permission under the Licensed Rights, such
as reproduction, public display, public performance, distribution,
dissemination, communication, or importation, and to make material
available to the public including in ways that members of the
public may access the material from a place and at a time
individually chosen by them.
l. Sui Generis Database Rights means rights other than copyright
resulting from Directive 96/9/EC of the European Parliament and of
the Council of 11 March 1996 on the legal protection of databases,
as amended and/or succeeded, as well as other essentially
equivalent rights anywhere in the world.
m. You means the individual or entity exercising the Licensed Rights
under this Public License. Your has a corresponding meaning.
Section 2 -- Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License,
the Licensor hereby grants You a worldwide, royalty-free,
non-sublicensable, non-exclusive, irrevocable license to
exercise the Licensed Rights in the Licensed Material to:
a. reproduce and Share the Licensed Material, in whole or
in part; and
b. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where
Exceptions and Limitations apply to Your use, this Public
License does not apply, and You do not need to comply with
its terms and conditions.
3. Term. The term of this Public License is specified in Section
6(a).
4. Media and formats; technical modifications allowed. The
Licensor authorizes You to exercise the Licensed Rights in
all media and formats whether now known or hereafter created,
and to make technical modifications necessary to do so. The
Licensor waives and/or agrees not to assert any right or
authority to forbid You from making technical modifications
necessary to exercise the Licensed Rights, including
technical modifications necessary to circumvent Effective
Technological Measures. For purposes of this Public License,
simply making modifications authorized by this Section 2(a)
(4) never produces Adapted Material.
5. Downstream recipients.
a. Offer from the Licensor -- Licensed Material. Every
recipient of the Licensed Material automatically
receives an offer from the Licensor to exercise the
Licensed Rights under the terms and conditions of this
Public License.
b. Additional offer from the Licensor -- Adapted Material.
Every recipient of Adapted Material from You
automatically receives an offer from the Licensor to
exercise the Licensed Rights in the Adapted Material
under the conditions of the Adapter's License You apply.
c. No downstream restrictions. You may not offer or impose
any additional or different terms or conditions on, or
apply any Effective Technological Measures to, the
Licensed Material if doing so restricts exercise of the
Licensed Rights by any recipient of the Licensed
Material.
6. No endorsement. Nothing in this Public License constitutes or
may be construed as permission to assert or imply that You
are, or that Your use of the Licensed Material is, connected
with, or sponsored, endorsed, or granted official status by,
the Licensor or others designated to receive attribution as
provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not
licensed under this Public License, nor are publicity,
privacy, and/or other similar personality rights; however, to
the extent possible, the Licensor waives and/or agrees not to
assert any such rights held by the Licensor to the limited
extent necessary to allow You to exercise the Licensed
Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this
Public License.
3. To the extent possible, the Licensor waives any right to
collect royalties from You for the exercise of the Licensed
Rights, whether directly or through a collecting society
under any voluntary or waivable statutory or compulsory
licensing scheme. In all other cases the Licensor expressly
reserves any right to collect such royalties.
Section 3 -- License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the
following conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified
form), You must:
a. retain the following if it is supplied by the Licensor
with the Licensed Material:
i. identification of the creator(s) of the Licensed
Material and any others designated to receive
attribution, in any reasonable manner requested by
the Licensor (including by pseudonym if
designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of
warranties;
v. a URI or hyperlink to the Licensed Material to the
extent reasonably practicable;
b. indicate if You modified the Licensed Material and
retain an indication of any previous modifications; and
c. indicate the Licensed Material is licensed under this
Public License, and include the text of, or the URI or
hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any
reasonable manner based on the medium, means, and context in
which You Share the Licensed Material. For example, it may be
reasonable to satisfy the conditions by providing a URI or
hyperlink to a resource that includes the required
information.
3. If requested by the Licensor, You must remove any of the
information required by Section 3(a)(1)(A) to the extent
reasonably practicable.
b. ShareAlike.
In addition to the conditions in Section 3(a), if You Share
Adapted Material You produce, the following conditions also apply.
1. The Adapter's License You apply must be a Creative Commons
license with the same License Elements, this version or
later, or a BY-SA Compatible License.
2. You must include the text of, or the URI or hyperlink to, the
Adapter's License You apply. You may satisfy this condition
in any reasonable manner based on the medium, means, and
context in which You Share Adapted Material.
3. You may not offer or impose any additional or different terms
or conditions on, or apply any Effective Technological
Measures to, Adapted Material that restrict exercise of the
rights granted under the Adapter's License You apply.
Section 4 -- Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that
apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
to extract, reuse, reproduce, and Share all or a substantial
portion of the contents of the database;
b. if You include all or a substantial portion of the database
contents in a database in which You have Sui Generis Database
Rights, then the database in which You have Sui Generis Database
Rights (but not its individual contents) is Adapted Material,
including for purposes of Section 3(b); and
c. You must comply with the conditions in Section 3(a) if You Share
all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not
replace Your obligations under this Public License where the Licensed
Rights include other Copyright and Similar Rights.
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
c. The disclaimer of warranties and limitation of liability provided
above shall be interpreted in a manner that, to the extent
possible, most closely approximates an absolute disclaimer and
waiver of all liability.
Section 6 -- Term and Termination.
a. This Public License applies for the term of the Copyright and
Similar Rights licensed here. However, if You fail to comply with
this Public License, then Your rights under this Public License
terminate automatically.
b. Where Your right to use the Licensed Material has terminated under
Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided
it is cured within 30 days of Your discovery of the
violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any
right the Licensor may have to seek remedies for Your violations
of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the
Licensed Material under separate terms or conditions or stop
distributing the Licensed Material at any time; however, doing so
will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
License.
Section 7 -- Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different
terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the
Licensed Material not stated herein are separate from and
independent of the terms and conditions of this Public License.
Section 8 -- Interpretation.
a. For the avoidance of doubt, this Public License does not, and
shall not be interpreted to, reduce, limit, restrict, or impose
conditions on any use of the Licensed Material that could lawfully
be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is
deemed unenforceable, it shall be automatically reformed to the
minimum extent necessary to make it enforceable. If the provision
cannot be reformed, it shall be severed from this Public License
without affecting the enforceability of the remaining terms and
conditions.
c. No term or condition of this Public License will be waived and no
failure to comply consented to unless expressly agreed to by the
Licensor.
d. Nothing in this Public License constitutes or may be interpreted
as a limitation upon, or waiver of, any privileges and immunities
that apply to the Licensor or You, including from the legal
processes of any jurisdiction or authority.
=======================================================================
Creative Commons is not a party to its public
licenses. Notwithstanding, Creative Commons may elect to apply one of
its public licenses to material it publishes and in those instances
will be considered the “Licensor.” The text of the Creative Commons
public licenses is dedicated to the public domain under the CC0 Public
Domain Dedication. Except for the limited purpose of indicating that
material is shared under a Creative Commons public license or as
otherwise permitted by the Creative Commons policies published at
creativecommons.org/policies, Creative Commons does not authorize the
use of the trademark "Creative Commons" or any other trademark or logo
of Creative Commons without its prior written consent including,
without limitation, in connection with any unauthorized modifications
to any of its public licenses or any other arrangements,
understandings, or agreements concerning use of licensed material. For
the avoidance of doubt, this paragraph does not form part of the
public licenses.
Creative Commons may be contacted at creativecommons.org.
</pre>
</details>
</p>
</body>
</html>
<div class="paragraph">
<p>In a nutshell, means you can:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Use it in commercial/proprietary/internal works&#8230;&#8203;</p>
</li>
<li>
<p>Expand upon/change the specification&#8230;&#8203;</p>
<div class="ulist">
<ul>
<li>
<p>(As long as it is released under the same Creative Commons license)</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<div class="paragraph">
<p>As long as you attribute the original (this document). This can be as simple as something like:</p>
</div>
<div class="exampleblock">
<div class="content">
<div class="paragraph">
<p>Based on WireProto version &lt;protocol version&gt; as found at <a href="https://wireproto.io/" class="bare">https://wireproto.io/</a>.</p>
</div>
</div>
</div>
<div class="paragraph">
<p>More details certainly helps, though; you may want to mention the exact date you "forked" it, etc.</p>
</div>
<div class="paragraph">
<p>Please see the full text as collapsed above or <a href="https://creativecommons.org/licenses/by-sa/4.0/legalcode.en" target="_blank" rel="noopener">the online version</a> of the license for full legal copy.</p>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<div class="title">Note</div>
</td>
<td class="content">
In the event of the embedded text in this document differing from the online version, the online version is assumed to take precedence as the valid license applicable to this work.
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="sect1">
<h2 id="proto"><a class="link" href="#proto">2. Protocol</a></h2>
<div class="sectionbody">
<div class="paragraph">
<p>The WireProto data packing API is a custom wire protocol//message format designed for incredibly performant, unambiguous, predictable, platform-agnostic, client-agnostic communication. It is based heavily on the <a href="https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key" target="_blank" rel="noopener">OpenSSH "v1" key format</a> <a href="https://git.r00t2.io/r00t2/go_sshkeys/src/branch/master/_ref/KEY_GUIDE.html#v1_plain_2">(example/details)</a> packing method.</p>
</div>
<div class="paragraph">
<p>It supports arbitrary binary values, which means they can be anything according to the implementation-specific details; a common practice is to encode ("marshal") a Go struct to JSON bytes, and set that as a WireProto field&#8217;s value.</p>
</div>
<div class="paragraph">
<p>It supports both static construction/parsing/dissection and stream approaches in a single format, as well as multiple commands per request message/multiple answers per response message.</p>
</div>
<div class="paragraph">
<p><strong>All</strong> packed uint32 values are big-endian.</p>
</div>
<div class="paragraph">
<p>This specification <a href="#proto_ver">Protocol Version</a> is <code>1</code> (<code>0x00000001</code>).</p>
</div>
<div class="sect2">
<h3 id="lib"><a class="link" href="#lib">2.1. Library</a></h3>
<div class="paragraph">
<p>This protocol specification is accompanied with a reference library for Golang, <a href="https://git.r00t2.io/r00t2/go_wireproto" target="_blank" rel="noopener">"WireProto"</a> (<a href="https://git.r00t2.io/r00t2/wireproto" target="_blank" rel="noopener"><em>source</em></a>):</p>
</div>
<a href="https://pkg.go.dev/go.pkg.dev/r00t2.io/wireproto">
<img src="https://pkg.go.dev/badge/go.pkg.dev/r00t2.io/wireproto.svg"
alt="Go Reference">
</a>
</div>
<div class="sect2">
<h3 id="ytho"><a class="link" href="#ytho">2.2. Why a Custom Message Format?</a></h3>
<div class="paragraph">
<p>Because existing ones (e.g. JSON, XML, YAML) are slow/bloaty, inaccurate, and/or inflexible. They struggle with binary or abritrary data (or in e.g. XML&#8217;s case requiring intermediate conditional encoding/decoding).</p>
</div>
<div class="paragraph">
<p>If it can be represented as bytes (which all digital data can), WireProto can send and receive it.</p>
</div>
<div class="paragraph">
<p>Additionally:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><a href="https://protobuf.dev/" target="_blank" rel="noopener"><strong>Protobuf</strong></a> has performance issues (yes, really; protobufs have large overhead) and is restrictive on data types for future-proofing.</p>
</li>
<li>
<p><a href="https://go.dev/blog/gob" target="_blank" rel="noopener"><strong>Gob</strong></a> is very language-limiting and does not support e.g. nil pointers and cyclical values.</p>
</li>
<li>
<p><a href="https://capnproto.org/" target="_blank" rel="noopener">Cap&#8217;n Proto</a> has wide language support and excellent performance but is terribly non-idiomatic, requiring the code to be generated from the schema and not vice versa (which is only ideal if you have only one communication interface).</p>
</li>
<li>
<p><a href="https://en.wikipedia.org/wiki/JSON_streaming" target="_blank" rel="noopener">JSON streams</a> have no delimiters defined, and thus this makes it an inconvenience if using a parser that does not know when the message ends/is complete, or if it is expecting a standalone JSON object.</p>
</li>
</ul>
</div>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<div class="title">Tip</div>
</td>
<td class="content">
<div class="paragraph">
<p>WireProto is only used for binary packing/unpacking; this means it can be used with any e.g. <a href="https://pkg.go.dev/net#Conn" target="_blank" rel="noopener"><code>net.Conn</code></a> (and even has helper functions explicitly to facilitate this), storage on-disk, etc.</p>
</div>
<div class="paragraph">
<p>Thus it is transport/storage-agnostic, and can be used with a <a href="https://pkg.go.dev/net#Dial" target="_blank" rel="noopener">TCP socket, UDP socket, IPC (InterProcess Communication)/UDS (UNIX Domain Socket) handle,</a> <a href="https://pkg.go.dev/crypto/tls#Dial" target="_blank" rel="noopener">TLS-tunneled TCP socket</a>, etc.</p>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="msg"><a class="link" href="#msg">3. Message Format</a></h2>
<div class="sectionbody">
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<div class="title">Tip</div>
</td>
<td class="content">
<div class="paragraph">
<p>Throughout this document, you may see references to things like <code>LF</code>, <code>SOH</code>, and so forth.</p>
</div>
<div class="paragraph">
<p>These refer to <em>ASCII control characters</em>. You will also see many values represented in hex.</p>
</div>
<div class="paragraph">
<p>You can find more details about this (along with a full ASCII reference) <a href="https://square-r00t.net/ascii.html" target="_blank" rel="noopener">here</a>. Note that the socket API fully supports UTF-8&#8201;&#8212;&#8201;just be sure that your <a href="#alloc_size">Size Allocator</a> are aligned to the byte count, not character count.</p>
</div>
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>Each <strong>message</strong> is generally composed of:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>The <a href="#msg_respstatus">Response Status</a><sup class="footnote" id="_footnote_responly">[<a id="_footnoteref_1" class="footnote" href="#_footnotedef_1" title="View footnote.">1</a>]</sup></p>
</li>
<li>
<p>A <a href="#cksum">Checksum</a><sup class="footnote" id="_footnote_optclient">[<a id="_footnoteref_2" class="footnote" href="#_footnotedef_2" title="View footnote.">2</a>]</sup><sup class="footnote" id="_footnote_reqsrv">[<a id="_footnoteref_3" class="footnote" href="#_footnotedef_3" title="View footnote.">3</a>]</sup></p>
</li>
<li>
<p>A <a href="#proto_ver">Protocol Version</a></p>
</li>
<li>
<p>A <a href="#hdrs_msgstart"><code>MSGSTART</code> Header Prefix</a></p>
</li>
<li>
<p>A <a href="#msg_grp">Record Group</a> <a href="#alloc_cnt">Count Allocator</a></p>
</li>
<li>
<p>A <a href="#msg_grp">Record Group</a> <a href="#alloc_size">Size Allocator</a></p>
</li>
<li>
<p>A <a href="#hdrs_bodystart"><code>BODYSTART</code> Header Prefix</a></p>
</li>
<li>
<p>One (or more) <a href="#msg_grp">Record Group</a>(s), each of which contain:</p>
<div class="ulist">
<ul>
<li>
<p>One (or more) <a href="#msg_grp_rec">Record</a>(s), each of which contain:</p>
<div class="ulist">
<ul>
<li>
<p>One (or more) <a href="#msg_grp_rec_kv">Field/Value pair</a>(s), each of which contain:</p>
<div class="ulist">
<ul>
<li>
<p>A <a href="#msg_grp_rec_kv_nm">Field Name</a></p>
</li>
<li>
<p>A <a href="#msg_grp_rec_kv_val">Field Value</a></p>
</li>
<li>
<p>A <a href="#msg_grp_recresp">Copy Record</a><sup class="footnoteref">[<a class="footnote" href="#_footnotedef_1" title="View footnote.">1</a>]</sup></p>
</li>
</ul>
</div>
</li>
</ul>
</div>
</li>
</ul>
</div>
</li>
<li>
<p>A <a href="#hdrs_bodyend"><code>BODYEND</code> Sequence</a></p>
</li>
<li>
<p>A <a href="#hdrs_msgend"><code>MSGEND</code> Sequence</a></p>
</li>
</ul>
</div>
<div class="sect2">
<h3 id="msg_respstatus"><a class="link" href="#msg_respstatus">3.1. Response Status</a></h3>
<div class="paragraph">
<p>For responses, their messages have an additional byte prepended; a status indicator.
This allows client programs to quickly bail in the case of an error if no further parsing is desired.</p>
</div>
<div class="paragraph">
<p>The status will be indicated by one of <a href="#hdrs_respstart">two values</a>: an ASCII <code>ACK</code> (<code>0x06</code>) for all requests being returned successfully or an ASCII <code>NAK</code> (<code>0x15</code>) if one or more errors were encountered across all records.</p>
</div>
</div>
<div class="sect2">
<h3 id="proto_ver"><a class="link" href="#proto_ver">3.2. Protocol Version</a></h3>
<div class="paragraph">
<p>The protocol version is a packed uint32 that denotes which version of this protocol specification is being used.</p>
</div>
<div class="paragraph">
<p>It is maintained seperately from the <strong>library</strong> version/repo tags.</p>
</div>
<div class="paragraph">
<p>The current protocol version (as demonstrated in this document) is <code>1</code> (<code>0x00000001</code>).</p>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<div class="title">Note</div>
</td>
<td class="content">
Version <code>0</code> is reserved for current <code>HEAD</code> of the <code>master</code> branch of this specification and should be considered experimental.
</td>
</tr>
</table>
</div>
</div>
<div class="sect2">
<h3 id="msg_grp"><a class="link" href="#msg_grp">3.3. Record Group</a></h3>
<div class="paragraph">
<p>A record group contains multiple related <a href="#msg_grp_rec">Records</a>. It is common to only have a single Record Group.</p>
</div>
<div class="paragraph">
<p>Its structure is:</p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p><a href="#msg_grp_rec">Record</a> <a href="#alloc_cnt">Count Allocator</a></p>
</li>
<li>
<p><a href="#msg_grp_rec">Record</a> <a href="#alloc_size">Size Allocator</a></p>
</li>
<li>
<p>One (or more) <a href="#msg_grp_rec">Records</a></p>
</li>
</ol>
</div>
<div class="sect3">
<h4 id="msg_grp_rec"><a class="link" href="#msg_grp_rec">3.3.1. Record</a></h4>
<div class="paragraph">
<p>A record contains multiple related <a href="#msg_grp_rec_kv">Field/Value Pairs (FVP)</a>. It is typical to only have a single Record.</p>
</div>
<div class="paragraph">
<p>Its structure is:</p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p><a href="#msg_grp_rec_kv">Field/Value Pair (Key/Value Pair)</a> <a href="#alloc_cnt">Count Allocator</a></p>
</li>
<li>
<p><a href="#msg_grp_rec_kv">Field/Value Pair (Key/Value Pair)</a> <a href="#alloc_size">Size Allocator</a></p>
</li>
<li>
<p>One (or more) <a href="#msg_grp_rec_kv">Field/Value Pairs</a></p>
</li>
</ol>
</div>
<div class="admonitionblock important">
<table>
<tr>
<td class="icon">
<div class="title">Important</div>
</td>
<td class="content">
<div class="paragraph">
<p>For response messages, the record&#8217;s size allocator (but NOT the count allocator) includes the <a href="#msg_grp_recresp">Copy Record</a> size for each response record copy!<sup class="footnoteref">[<a class="footnote" href="#_footnotedef_1" title="View footnote.">1</a>]</sup></p>
</div>
</td>
</tr>
</table>
</div>
<div class="sect4">
<h5 id="msg_grp_rec_kv"><a class="link" href="#msg_grp_rec_kv">3.3.1.1. Field/Value Pair (Key/Value Pair)</a></h5>
<div class="paragraph">
<p>A field/value pair (also referred to as a key/value pair) contains a matched <a href="#msg_grp_rec_kv_nm">Field Name</a> and its <a href="#msg_grp_rec_kv_val">Field Value</a>.</p>
</div>
<div class="paragraph">
<p>Its structure is:</p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p><a href="#msg_grp_rec_kv_nm">Field Name</a> <a href="#alloc_size">Size Allocator</a></p>
</li>
<li>
<p><a href="#msg_grp_rec_kv_val">Field Value</a> <a href="#alloc_size">Size Allocator</a></p>
</li>
<li>
<p>A single <a href="#msg_grp_rec_kv_nm">Field Name</a></p>
</li>
<li>
<p>A single matching <a href="#msg_grp_rec_kv_val">Field Value</a></p>
</li>
</ol>
</div>
<div class="admonitionblock important">
<table>
<tr>
<td class="icon">
<div class="title">Important</div>
</td>
<td class="content">
<div class="paragraph">
<p>Unlike most/all other <a href="#alloc">Allocators</a> for other sections/levels, the field name and value allocators are consecutive <a href="#alloc_size">Size Allocators</a>! This is because there is only one field name and value per record.</p>
</div>
</td>
</tr>
</table>
</div>
<div class="sect5">
<h6 id="msg_grp_rec_kv_nm"><a class="link" href="#msg_grp_rec_kv_nm">3.3.1.1.1. Field Name</a></h6>
<div class="paragraph">
<p>The field name is usually from a finite set of allowed names. The <a href="#msg_grp_rec_kv_val">Field Value</a>, while written as bytes, often contains a data structure defined by the field name. (A field name is closer to a "value type".) It <strong>must</strong> be a UTF-8 string.</p>
</div>
<div class="paragraph">
<p>Its structure is:</p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>The name in bytes</p>
</li>
</ol>
</div>
</div>
<div class="sect5">
<h6 id="msg_grp_rec_kv_val"><a class="link" href="#msg_grp_rec_kv_val">3.3.1.1.2. Field Value</a></h6>
<div class="paragraph">
<p>A field&#8217;s value is, on the wire, just a series of bytes. The actual content of those bytes, including any structure or encoding, is likely to/probably depends on the paired <a href="#msg_grp_rec_kv_nm">Field Name</a>.</p>
</div>
<div class="paragraph">
<p>Its structure is:</p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>The value in bytes</p>
</li>
</ol>
</div>
</div>
</div>
<div class="sect4">
<h5 id="msg_grp_recresp"><a class="link" href="#msg_grp_recresp">3.3.1.2. Copy Record (Response Copy of Request)</a></h5>
<div class="paragraph">
<p>This contains a "copy" of the original/request&#8217;s <a href="#msg_grp_rec">Record</a> that this record is in response to.</p>
</div>
<div class="paragraph">
<p>It is a variant of a <a href="#msg_grp_rec">Record</a> used exclusively in responses, and is tied to (included in) each response&#8217;s <a href="#msg_grp_rec_kv">FVP</a>.</p>
</div>
<div class="paragraph">
<p>Its structure is:</p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p><a href="#msg_grp_rec_kvcpy">Field/Value Pair (Key/Value Pair) (Response Copy)</a> <a href="#alloc_cnt">Count Allocator</a></p>
</li>
<li>
<p><a href="#msg_grp_rec_kvcpy">Field/Value Pair (Key/Value Pair) (Response Copy)</a> <a href="#alloc_size">Size Allocator</a></p>
</li>
<li>
<p>One (or more) <a href="#msg_grp_rec_kvcpy">Field/Value Pairs (Response Copy)</a></p>
</li>
</ol>
</div>
<div class="sect5">
<h6 id="msg_grp_rec_kvcpy"><a class="link" href="#msg_grp_rec_kvcpy">3.3.1.2.1. Field/Value Pair (Key/Value Pair) (Response Copy)</a></h6>
<div class="paragraph">
<p>A field/value pair (also referred to as a key/value pair) contains a matched <a href="#msg_grp_rec_kv_nm">Field Name</a> and its <a href="#msg_grp_rec_kv_val">Field Value</a>.</p>
</div>
<div class="paragraph">
<p>It is a variant of a <a href="#msg_grp_rec_kv">Field/Value Pair</a> used exclusively in response copies of the original request&#8217;s FVP.</p>
</div>
<div class="paragraph">
<p>Its structure is:</p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p><a href="#msg_grp_rec_kv_nm">Field Name</a> <a href="#alloc_size">Size Allocator</a></p>
</li>
<li>
<p><a href="#msg_grp_rec_kv_val">Field Value</a> <a href="#alloc_size">Size Allocator</a></p>
</li>
<li>
<p>A single <a href="#msg_grp_rec_kv_nm">Field Name</a></p>
</li>
<li>
<p>A single matching <a href="#msg_grp_rec_kv_val">Field Value</a></p>
</li>
</ol>
</div>
<div class="admonitionblock important">
<table>
<tr>
<td class="icon">
<div class="title">Important</div>
</td>
<td class="content">
<div class="paragraph">
<p>Unlike most/all other <a href="#alloc">Allocators</a> for other sections/levels, the field name and value allocators are consecutive <a href="#alloc_size">Size Allocators</a>! This is because there is only one field name and value per record.</p>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="cksum"><a class="link" href="#cksum">4. Checksums</a></h2>
<div class="sectionbody">
<div class="paragraph">
<p>Checksums are optional for the client but the server will <strong>always</strong> send them. <strong>If present</strong> in the request, the server will validate to ensure the checksum matches the message body (<a href="#hdrs_bodystart">body start</a> to <a href="#hdrs_bodyend">body end</a>, headers included). If the checksum does not match, an error will be returned.</p>
</div>
<div class="paragraph">
<p>They are represented as a big-endian-packed uint32.</p>
</div>
<div class="paragraph">
<p>The checksum must be prefixed with a <a href="#hdrs_cksum"><code>CKSUM</code> Header Prefix</a>. If no checksum is provided, this prefix must <strong>not</strong> be included in the sequence.</p>
</div>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<div class="title">Tip</div>
</td>
<td class="content">
<div class="paragraph">
<p>You can quickly check if a checksum is present by checking the first byte in requests or the second byte in responses. If it is <code>ESC</code> (<code>0x1b</code>), a checksum is provided. If it is <code>SOH</code> (<code>0x01</code>), one was <strong>not</strong> provided.</p>
</div>
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>The checksum method used is the <a href="https://users.ece.cmu.edu/~koopman/crc/crc32.html" target="_blank" rel="noopener">IEEE 802.3 CRC-32</a>, which should be natively available for all/most client implementations as it is perhaps the most ubiquitous of CRC-32 variants. (Polynomial <code>0x04c11db7</code>, reversed polynomial <code>0xedb88320</code>.)</p>
</div>
<div class="paragraph">
<p>To confirm you are using the correct CRC32 implementation (as there are a <strong>ton</strong> of "CRC-32" algorithms and methods out there), use the following validations:</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 1. CRC-32 Validations</caption>
<colgroup>
<col style="width: 20%;">
<col style="width: 30%;">
<col style="width: 10%;">
<col style="width: 20%;">
<col style="width: 20%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-center valign-middle">String</th>
<th class="tableblock halign-center valign-middle">Bytes</th>
<th class="tableblock halign-center valign-middle">Checksum (integer)</th>
<th class="tableblock halign-center valign-middle">Checksum (bytes, little-endian)</th>
<th class="tableblock halign-center valign-middle">Checksum (bytes, big-endian)</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-center valign-middle"><p class="tableblock"><code>FooBarBazQuux</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>0x466f6f42617242617a51757578</code></p></td>
<td class="tableblock halign-center valign-middle"><p class="tableblock"><code>983022564</code></p></td>
<td class="tableblock halign-center valign-middle"><p class="tableblock"><code>0xe4bb973a</code></p></td>
<td class="tableblock halign-center valign-middle"><p class="tableblock"><code>0x3a97bbe4</code></p></td>
</tr>
<tr>
<td class="tableblock halign-center valign-middle"><p class="tableblock"><code>0123456789abcdef</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>0x30313233343536373839616263646566</code></p></td>
<td class="tableblock halign-center valign-middle"><p class="tableblock"><code>1757737011</code></p></td>
<td class="tableblock halign-center valign-middle"><p class="tableblock"><code>0x33f0c468</code></p></td>
<td class="tableblock halign-center valign-middle"><p class="tableblock"><code>0x68c4f033</code></p></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="sect1">
<h2 id="hdrs"><a class="link" href="#hdrs">5. Headers</a></h2>
<div class="sectionbody">
<div class="paragraph">
<p>Certain sections are wrapped with an identifying header. Those headers are included below for reference.</p>
</div>
<div class="sect2">
<h3 id="hdrs_respstart"><a class="link" href="#hdrs_respstart">5.1. <code>RESPSTART</code> Byte Sequence</a></h3>
<div class="paragraph">
<p>Responses have a <a href="#msg_respstatus">Response Status</a>.<sup class="footnoteref">[<a class="footnote" href="#_footnotedef_1" title="View footnote.">1</a>]</sup></p>
</div>
<div class="paragraph">
<p>It is either an <code>ACK</code> (<code>0x06</code>) or <code>NAK</code> (<code>0x15</code>).</p>
</div>
</div>
<div class="sect2">
<h3 id="hdrs_cksum"><a class="link" href="#hdrs_cksum">5.2. <code>CKSUM</code> Header Prefix</a></h3>
<div class="paragraph">
<p>A checksum, if provided, will have a prefix header of <code>ESC</code> (<code>0x1b</code>).</p>
</div>
</div>
<div class="sect2">
<h3 id="hdrs_msgstart"><a class="link" href="#hdrs_msgstart">5.3. <code>MSGSTART</code> Header Prefix</a></h3>
<div class="paragraph">
<p>The message start header indicates a start of a message.</p>
</div>
<div class="paragraph">
<p>It is an <code>SOH</code> (<code>0x01</code>).</p>
</div>
</div>
<div class="sect2">
<h3 id="hdrs_bodystart"><a class="link" href="#hdrs_bodystart">5.4. <code>BODYSTART</code> Header Prefix</a></h3>
<div class="paragraph">
<p>The body start header indicates that actual data/records follows.</p>
</div>
<div class="paragraph">
<p>It is an <code>STX</code> (<code>0x02</code>).</p>
</div>
</div>
<div class="sect2">
<h3 id="hdrs_bodyend"><a class="link" href="#hdrs_bodyend">5.5. <code>BODYEND</code> Sequence</a></h3>
<div class="paragraph">
<p>The body end prefix indicates the end of data/records.</p>
</div>
<div class="paragraph">
<p>It is an <code>ETX</code> (<code>0x03</code>).</p>
</div>
</div>
<div class="sect2">
<h3 id="hdrs_msgend"><a class="link" href="#hdrs_msgend">5.6. <code>MSGEND</code> Sequence</a></h3>
<div class="paragraph">
<p>The message end prefix indicates that a message in its entirety has ended.</p>
</div>
<div class="paragraph">
<p>It is an <code>EOT</code> (<code>0x04</code>).</p>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="alloc"><a class="link" href="#alloc">6. Allocators</a></h2>
<div class="sectionbody">
<div class="paragraph">
<p>There are two type of allocators included for each following sequence of bytes: <code>count allocators</code> and <code>size allocators</code>.</p>
</div>
<div class="paragraph">
<p>They can be used by clients to determine the size of destination buffers, and are used by the server to efficiently unpack requests.</p>
</div>
<div class="paragraph">
<p>They are usually paired together with the count allocator preceding the size allocator, but not always (e.g. <a href="#msg_grp_rec_kv">Field/Value Pair (Key/Value Pair)</a> have two <a href="#alloc_size">Size Allocator</a>).</p>
</div>
<div class="paragraph">
<p>All allocators are unsigned 32-bit integers, little-endian-packed.</p>
</div>
<div class="sect2">
<h3 id="alloc_cnt"><a class="link" href="#alloc_cnt">6.1. Count Allocator</a></h3>
<div class="paragraph">
<p>Count allocators indicate <strong>how many</strong> children objects are contained.</p>
</div>
</div>
<div class="sect2">
<h3 id="alloc_size"><a class="link" href="#alloc_size">6.2. Size Allocator</a></h3>
<div class="paragraph">
<p>Size allocators indicate <strong>how much</strong> (in bytes) all children objects are combined together. It includes e.g. separators, etc.</p>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="ref"><a class="link" href="#ref">7. Reference Model and Examples</a></h2>
<div class="sectionbody">
<div class="paragraph">
<p>For a more visual explanation, given the following e.g. Golang structs from the <a href="https://pkg.go.dev/r00t2.io/wireproto" target="_blank" rel="noopener">Golang reference library</a> (<code>wireproto.Request{}</code> and <code>wireproto.Response{}</code>):</p>
</div>
<div class="sect2">
<h3 id="ref_single"><a class="link" href="#ref_single">7.1. Single/Simple</a></h3>
<div class="sect3">
<h4 id="ref_single_req"><a class="link" href="#ref_single_req">7.1.1. Single/Simple Request</a></h4>
<details>
<summary class="title">Example Message Structure (Simple Request)</summary>
<div class="content">
<div class="listingblock">
<div class="content">
<pre class="rouge highlight"><code data-lang="go"><span class="k">package</span> <span class="n">wireproto</span>
<span class="k">var</span> <span class="p">(</span>
<span class="c">// REQUEST (Simple)</span>
<span class="n">testSimpleReq</span> <span class="o">*</span><span class="n">Request</span> <span class="o">=</span> <span class="o">&amp;</span><span class="n">Request</span><span class="p">{</span>
<span class="n">ProtocolVersion</span><span class="o">:</span> <span class="n">ProtoVersion</span><span class="p">,</span>
<span class="n">RecordGroups</span><span class="o">:</span> <span class="p">[]</span><span class="o">*</span><span class="n">RequestRecordGroup</span><span class="p">{</span>
<span class="o">&amp;</span><span class="n">RequestRecordGroup</span><span class="p">{</span>
<span class="n">Records</span><span class="o">:</span> <span class="p">[]</span><span class="o">*</span><span class="n">RequestRecord</span><span class="p">{</span>
<span class="o">&amp;</span><span class="n">RequestRecord</span><span class="p">{</span>
<span class="n">Pairs</span><span class="o">:</span> <span class="p">[]</span><span class="o">*</span><span class="n">FieldValuePair</span><span class="p">{</span>
<span class="o">&amp;</span><span class="n">FieldValuePair</span><span class="p">{</span>
<span class="n">Name</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"field1"</span><span class="p">),</span>
<span class="n">Value</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"value1"</span><span class="p">),</span>
<span class="p">},</span>
<span class="o">&amp;</span><span class="n">FieldValuePair</span><span class="p">{</span>
<span class="n">Name</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"field2"</span><span class="p">),</span>
<span class="n">Value</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"value2"</span><span class="p">),</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="p">}</span>
<span class="p">)</span></code></pre>
</div>
</div>
</div>
</details>
<div class="paragraph">
<p>Would then serialize as (in hex):</p>
</div>
<details>
<summary class="title">Annotated Hex</summary>
<div class="content">
<div class="listingblock">
<div class="content">
<pre class="rouge highlight"><code data-lang="text">// REQUEST (Simple)
-------- // (No Checksum Present)
01 // HDR:MSGSTART
00000001 // Protocol Version (1)
02 // HDR:BODYSTART
00000001 // Record Group Count (1)
00000038 // Record Groups Size (56)
// Record Group 1 (56 bytes)
00000001 // Record Count (1)
00000030 // Record Group Size (48)
// Record Group 1, Record 1 (48 bytes)
00000002 // Field/Value Count (2)
00000028 // Record Size (40)
// Record Group 1, Record 1, Field/Value 1 (20 bytes)
00000006 // Field Name Size (6)
00000006 // Field Value Size (6)
6669656c6431 // "field1"
76616c756531 // "value1"
// Record Group 1, Record 1, Field/Value 2 (20 bytes)
00000006 // Field Name Size (6)
00000006 // Field Value Size (6)
6669656c6432 // "field2"
76616c756532 // "value2"
03 // HDR:BODYEND
04 // HDR:MSGEND</code></pre>
</div>
</div>
</div>
</details>
<div class="paragraph">
<p>Or, non-annotated:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="rouge highlight"><code data-lang="text">01000000010200000001000000380000000100000030000000020000002800000006000000066669
656c643176616c75653100000006000000066669656c643276616c7565320304</code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="ref_single_resp"><a class="link" href="#ref_single_resp">7.1.2. Single/Simple Response</a></h4>
<details>
<summary class="title">Example Message Structure (Simple Response)</summary>
<div class="content">
<div class="listingblock">
<div class="content">
<pre class="rouge highlight"><code data-lang="go"><span class="k">package</span> <span class="n">wireproto</span>
<span class="k">var</span> <span class="p">(</span>
<span class="c">// RESPONSE (Simple)</span>
<span class="n">testSimpleResp</span> <span class="o">*</span><span class="n">Response</span> <span class="o">=</span> <span class="o">&amp;</span><span class="n">Response</span><span class="p">{</span>
<span class="n">Status</span><span class="o">:</span> <span class="n">AsciiACK</span><span class="p">,</span>
<span class="n">Checksum</span><span class="o">:</span> <span class="m">4005376897</span><span class="p">,</span> <span class="c">// 0xeebd3381</span>
<span class="n">ProtocolVersion</span><span class="o">:</span> <span class="n">ProtoVersion</span><span class="p">,</span>
<span class="n">RecordGroups</span><span class="o">:</span> <span class="p">[]</span><span class="o">*</span><span class="n">ResponseRecordGroup</span><span class="p">{</span>
<span class="o">&amp;</span><span class="n">ResponseRecordGroup</span><span class="p">{</span>
<span class="n">Records</span><span class="o">:</span> <span class="p">[]</span><span class="o">*</span><span class="n">ResponseRecord</span><span class="p">{</span>
<span class="o">&amp;</span><span class="n">ResponseRecord</span><span class="p">{</span>
<span class="n">Pairs</span><span class="o">:</span> <span class="p">[]</span><span class="o">*</span><span class="n">FieldValuePair</span><span class="p">{</span>
<span class="o">&amp;</span><span class="n">FieldValuePair</span><span class="p">{</span>
<span class="n">Name</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"data1"</span><span class="p">),</span>
<span class="n">Value</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"&lt;arbitrary data&gt;"</span><span class="p">),</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="n">OriginalRecord</span><span class="o">:</span> <span class="n">testSimpleReq</span><span class="o">.</span><span class="n">RecordGroups</span><span class="p">[</span><span class="m">0</span><span class="p">]</span><span class="o">.</span><span class="n">Records</span><span class="p">[</span><span class="m">0</span><span class="p">],</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="p">}</span>
<span class="p">)</span></code></pre>
</div>
</div>
</div>
</details>
<div class="paragraph">
<p>Would then serialize as (in hex):</p>
</div>
<details>
<summary class="title">Annotated Hex</summary>
<div class="content">
<div class="listingblock">
<div class="content">
<pre class="rouge highlight"><code data-lang="text">// RESPONSE (Simple)
06 // HDR:RESPSTART (Status: OK)
1b // HDR:CKSUM
5fde82e5 // Checksum Value (1608418021)
01 // HDR:MSGSTART
00000001 // Protocol Version (1)
02 // HDR:BODYSTART
00000001 // Record Group Count (1)
00000061 // Record Groups Size (97)
// Record Group 1 (97)
00000001 // Record Count (1)
00000059 // Record Group Size (89)
// Record Group 1, Record 1 (89 bytes)
00000001 // Field/Value Count (1)
0000001d // Record Size (29)
00000030 // Request Record Size (48)
// Record Group 1, Record 1, Field/Value 1 (29 bytes)
00000005 // Field Name Size (5)
00000010 // Field Value Size (16)
6461746131 // "data1"
3c6172626974726172792064 // "&lt;arbitrary data&gt;"
6174613e
// Record Group 1, Record 1 (REQUEST RECORD) (48 bytes)
00000002 // Field/Value Count (2)
00000028 // Record Size (40)
// Record Group 1, Record 1, Field/Value 1 (20 bytes)
00000006 // Field Name Size (6)
00000006 // Field Value Size (6)
6669656c6431 // "field1"
76616c756531 // "value1"
// Record Group 1, Record 1, Field/Value 2 (20 bytes)
00000006 // Field Name Size (6)
00000006 // Field Value Size (6)
6669656c6432 // "field2"
76616c756532 // "value2"
03 // HDR:BODYEND
04 // HDR:MSGEND</code></pre>
</div>
</div>
</div>
</details>
<div class="paragraph">
<p>Or, non-annotated:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="rouge highlight"><code data-lang="text">061b5fde82e501000000010200000001000000610000000100000059000000010000001d00000030
000000050000001064617461313c61726269747261727920646174613e0000000200000028000000
06000000066669656c643176616c75653100000006000000066669656c643276616c7565320304</code></pre>
</div>
</div>
</div>
</div>
<div class="sect2">
<h3 id="ref_multi"><a class="link" href="#ref_multi">7.2. Multiple/Many/Complex</a></h3>
<div class="paragraph">
<p>Multiple commands, parameters, etc. can be specified in one message.</p>
</div>
<div class="sect3">
<h4 id="ref_multi_req"><a class="link" href="#ref_multi_req">7.2.1. Complex Request</a></h4>
<details>
<summary class="title">Example Message Structure (Multiple/Many Requests, Single Message)</summary>
<div class="content">
<div class="listingblock">
<div class="content">
<pre class="rouge highlight"><code data-lang="go"><span class="k">package</span> <span class="n">wireproto</span>
<span class="k">var</span> <span class="p">(</span>
<span class="c">// REQUEST (Complex)</span>
<span class="n">testMultiReq</span> <span class="o">*</span><span class="n">Request</span> <span class="o">=</span> <span class="o">&amp;</span><span class="n">Request</span><span class="p">{</span>
<span class="n">ProtocolVersion</span><span class="o">:</span> <span class="n">ProtoVersion</span><span class="p">,</span>
<span class="n">RecordGroups</span><span class="o">:</span> <span class="p">[]</span><span class="o">*</span><span class="n">RequestRecordGroup</span><span class="p">{</span>
<span class="o">&amp;</span><span class="n">RequestRecordGroup</span><span class="p">{</span>
<span class="n">Records</span><span class="o">:</span> <span class="p">[]</span><span class="o">*</span><span class="n">RequestRecord</span><span class="p">{</span>
<span class="o">&amp;</span><span class="n">RequestRecord</span><span class="p">{</span>
<span class="n">Pairs</span><span class="o">:</span> <span class="p">[]</span><span class="o">*</span><span class="n">FieldValuePair</span><span class="p">{</span>
<span class="o">&amp;</span><span class="n">FieldValuePair</span><span class="p">{</span>
<span class="n">Name</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"fieldA1A"</span><span class="p">),</span>
<span class="n">Value</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"valueA1A"</span><span class="p">),</span>
<span class="p">},</span>
<span class="o">&amp;</span><span class="n">FieldValuePair</span><span class="p">{</span>
<span class="n">Name</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"fieldA1B"</span><span class="p">),</span>
<span class="n">Value</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"valueA1B"</span><span class="p">),</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="o">&amp;</span><span class="n">RequestRecord</span><span class="p">{</span>
<span class="n">Pairs</span><span class="o">:</span> <span class="p">[]</span><span class="o">*</span><span class="n">FieldValuePair</span><span class="p">{</span>
<span class="o">&amp;</span><span class="n">FieldValuePair</span><span class="p">{</span>
<span class="n">Name</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"fieldA2A"</span><span class="p">),</span>
<span class="n">Value</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"valueA2A"</span><span class="p">),</span>
<span class="p">},</span>
<span class="o">&amp;</span><span class="n">FieldValuePair</span><span class="p">{</span>
<span class="n">Name</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"fieldA2B"</span><span class="p">),</span>
<span class="n">Value</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"valueA2B"</span><span class="p">),</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="o">&amp;</span><span class="n">RequestRecordGroup</span><span class="p">{</span>
<span class="n">Records</span><span class="o">:</span> <span class="p">[]</span><span class="o">*</span><span class="n">RequestRecord</span><span class="p">{</span>
<span class="o">&amp;</span><span class="n">RequestRecord</span><span class="p">{</span>
<span class="n">Pairs</span><span class="o">:</span> <span class="p">[]</span><span class="o">*</span><span class="n">FieldValuePair</span><span class="p">{</span>
<span class="o">&amp;</span><span class="n">FieldValuePair</span><span class="p">{</span>
<span class="n">Name</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"fieldB1A"</span><span class="p">),</span>
<span class="n">Value</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"valueB1A"</span><span class="p">),</span>
<span class="p">},</span>
<span class="o">&amp;</span><span class="n">FieldValuePair</span><span class="p">{</span>
<span class="n">Name</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"fieldB1B"</span><span class="p">),</span>
<span class="n">Value</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"valueB1B"</span><span class="p">),</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="o">&amp;</span><span class="n">RequestRecord</span><span class="p">{</span>
<span class="n">Pairs</span><span class="o">:</span> <span class="p">[]</span><span class="o">*</span><span class="n">FieldValuePair</span><span class="p">{</span>
<span class="o">&amp;</span><span class="n">FieldValuePair</span><span class="p">{</span>
<span class="n">Name</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"fieldB2A"</span><span class="p">),</span>
<span class="n">Value</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"valueB2A"</span><span class="p">),</span>
<span class="p">},</span>
<span class="o">&amp;</span><span class="n">FieldValuePair</span><span class="p">{</span>
<span class="n">Name</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"fieldB2B"</span><span class="p">),</span>
<span class="n">Value</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"valueB2B"</span><span class="p">),</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="p">}</span>
<span class="p">)</span></code></pre>
</div>
</div>
</div>
</details>
<div class="paragraph">
<p>Would then serialize as (in hex):</p>
</div>
<details>
<summary class="title">Annotated Hex</summary>
<div class="content">
<div class="listingblock">
<div class="content">
<pre class="rouge highlight"><code data-lang="text">// REQUEST (Complex)
-------- // (No Checksum Present)
01 // HDR:MSGSTART
00000001 // Protocol Version (1)
02 // HDR:BODYSTART
00000002 // Record Group Count (2)
000000f0 // Record Groups Size (240)
// Record Group 1 (120 bytes)
00000002 // Record Count (2)
00000070 // Record Group Size (112)
// Record Group 1, Record 1 (56 bytes)
00000002 // Field/Value Count (2)
00000030 // Record Size (48)
// Record Group 1, Record 1, Field/Value 1 (24 bytes)
00000008 // Field Name Size (8)
00000008 // Field Value Size (8)
6669656c64413141 // "fieldA1A"
76616c7565413141 // "valueA1A"
// Record Group 1, Record 1, Field/Value 2 (24 bytes)
00000008 // Field Name Size (8)
00000008 // Field Value Size (8)
6669656c64413142 // "fieldA1B"
76616c7565413142 // "valueA1B"
// Record Group 1, Record 2 (56 bytes)
00000002 // Field/Value Count (2)
00000030 // Record Size (48)
// Record Group 1, Record 2, Field/Value 1 (24 bytes)
00000008 // Field Name Size (8)
00000008 // Field Value Size (8)
6669656c64413241 // "fieldA2A"
76616c7565413241 // "valueA2A"
// Record Group 1, Record 2, Field/Value 2 (24 bytes)
00000008 // Field Name Size (8)
00000008 // Field Value Size (8)
6669656c64413242 // "fieldA2B"
76616c7565413242 // "valueA2B"
// Record Group 2 (120 bytes)
00000002 // Record Count (2)
00000070 // Record Group Size (112)
// Record Group 2, Record 1 (56 bytes)
00000002 // Field/Value Count (2)
00000030 // Record Size (48)
// Record Group 2, Record 1, Field/Value 1 (24 bytes)
00000008 // Field Name Size (8)
00000008 // Field Value Size (8)
6669656c64423141 // "fieldB1A"
76616c7565423141 // "valueB1A"
// Record Group 2, Record 1, Field/Value 2 (24 bytes)
00000008 // Field Name Size (8)
00000008 // Field Value Size (8)
6669656c64423142 // "fieldB1B"
76616c7565423142 // "valueB1B"
// Record Group 2, Record 2 (56 bytes)
00000002 // Field/Value Count (2)
00000030 // Record Size (48)
// Record Group 2, Record 2, Field/Value 1 (24 bytes)
00000008 // Field Name Size (8)
00000008 // Field Value Size (8)
6669656c64423241 // "fieldB2A"
76616c7565423241 // "valueB2A"
// Record Group 2, Record 2, Field/Value 2 (24 bytes)
00000008 // Field Name Size (8)
00000008 // Field Value Size (8)
6669656c64423242 // "fieldB2B"
76616c7565423242 // "valueB2B"
03 // HDR:BODYEND
04 // HDR:MSGEND</code></pre>
</div>
</div>
</div>
</details>
<div class="paragraph">
<p>Or, non-annotated:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="rouge highlight"><code data-lang="text">01000000010200000002000000f00000000200000070000000020000003000000008000000086669
656c6441314176616c756541314100000008000000086669656c6441314276616c75654131420000
00020000003000000008000000086669656c6441324176616c756541324100000008000000086669
656c6441324276616c75654132420000000200000070000000020000003000000008000000086669
656c6442314176616c756542314100000008000000086669656c6442314276616c75654231420000
00020000003000000008000000086669656c6442324176616c756542324100000008000000086669
656c6442324276616c75654232420304</code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="ref_multi_resp"><a class="link" href="#ref_multi_resp">7.2.2. Complex Response</a></h4>
<details>
<summary class="title">Example Message Structure (Response to Multiple/Many Requests, Single Message)</summary>
<div class="content">
<div class="listingblock">
<div class="content">
<pre class="rouge highlight"><code data-lang="go"><span class="k">package</span> <span class="n">wireproto</span>
<span class="k">var</span> <span class="p">(</span>
<span class="c">// RESPONSE (Complex)</span>
<span class="n">testMultiResp</span> <span class="o">*</span><span class="n">Response</span> <span class="o">=</span> <span class="o">&amp;</span><span class="n">Response</span><span class="p">{</span>
<span class="n">Status</span><span class="o">:</span> <span class="n">AsciiACK</span><span class="p">,</span>
<span class="n">Checksum</span><span class="o">:</span> <span class="m">2563794802</span><span class="p">,</span> <span class="c">// 98d06772</span>
<span class="n">ProtocolVersion</span><span class="o">:</span> <span class="n">ProtoVersion</span><span class="p">,</span>
<span class="n">RecordGroups</span><span class="o">:</span> <span class="p">[]</span><span class="o">*</span><span class="n">ResponseRecordGroup</span><span class="p">{</span>
<span class="o">&amp;</span><span class="n">ResponseRecordGroup</span><span class="p">{</span>
<span class="n">Records</span><span class="o">:</span> <span class="p">[]</span><span class="o">*</span><span class="n">ResponseRecord</span><span class="p">{</span>
<span class="o">&amp;</span><span class="n">ResponseRecord</span><span class="p">{</span>
<span class="n">Pairs</span><span class="o">:</span> <span class="p">[]</span><span class="o">*</span><span class="n">FieldValuePair</span><span class="p">{</span>
<span class="o">&amp;</span><span class="n">FieldValuePair</span><span class="p">{</span>
<span class="n">Name</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"dataA1"</span><span class="p">),</span>
<span class="n">Value</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"&lt;arbitrary data&gt;"</span><span class="p">),</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="n">OriginalRecord</span><span class="o">:</span> <span class="n">testMultiReq</span><span class="o">.</span><span class="n">RecordGroups</span><span class="p">[</span><span class="m">0</span><span class="p">]</span><span class="o">.</span><span class="n">Records</span><span class="p">[</span><span class="m">0</span><span class="p">],</span>
<span class="p">},</span>
<span class="o">&amp;</span><span class="n">ResponseRecord</span><span class="p">{</span>
<span class="n">Pairs</span><span class="o">:</span> <span class="p">[]</span><span class="o">*</span><span class="n">FieldValuePair</span><span class="p">{</span>
<span class="o">&amp;</span><span class="n">FieldValuePair</span><span class="p">{</span>
<span class="n">Name</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"dataA2"</span><span class="p">),</span>
<span class="n">Value</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"&lt;arbitrary data&gt;"</span><span class="p">),</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="n">OriginalRecord</span><span class="o">:</span> <span class="n">testMultiReq</span><span class="o">.</span><span class="n">RecordGroups</span><span class="p">[</span><span class="m">0</span><span class="p">]</span><span class="o">.</span><span class="n">Records</span><span class="p">[</span><span class="m">1</span><span class="p">],</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="o">&amp;</span><span class="n">ResponseRecordGroup</span><span class="p">{</span>
<span class="n">Records</span><span class="o">:</span> <span class="p">[]</span><span class="o">*</span><span class="n">ResponseRecord</span><span class="p">{</span>
<span class="o">&amp;</span><span class="n">ResponseRecord</span><span class="p">{</span>
<span class="n">Pairs</span><span class="o">:</span> <span class="p">[]</span><span class="o">*</span><span class="n">FieldValuePair</span><span class="p">{</span>
<span class="o">&amp;</span><span class="n">FieldValuePair</span><span class="p">{</span>
<span class="n">Name</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"dataB1"</span><span class="p">),</span>
<span class="n">Value</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"&lt;arbitrary data&gt;"</span><span class="p">),</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="n">OriginalRecord</span><span class="o">:</span> <span class="n">testMultiReq</span><span class="o">.</span><span class="n">RecordGroups</span><span class="p">[</span><span class="m">1</span><span class="p">]</span><span class="o">.</span><span class="n">Records</span><span class="p">[</span><span class="m">0</span><span class="p">],</span>
<span class="p">},</span>
<span class="o">&amp;</span><span class="n">ResponseRecord</span><span class="p">{</span>
<span class="n">Pairs</span><span class="o">:</span> <span class="p">[]</span><span class="o">*</span><span class="n">FieldValuePair</span><span class="p">{</span>
<span class="o">&amp;</span><span class="n">FieldValuePair</span><span class="p">{</span>
<span class="n">Name</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"dataB2"</span><span class="p">),</span>
<span class="n">Value</span><span class="o">:</span> <span class="p">[]</span><span class="kt">byte</span><span class="p">(</span><span class="s">"&lt;arbitrary data&gt;"</span><span class="p">),</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="n">OriginalRecord</span><span class="o">:</span> <span class="n">testMultiReq</span><span class="o">.</span><span class="n">RecordGroups</span><span class="p">[</span><span class="m">1</span><span class="p">]</span><span class="o">.</span><span class="n">Records</span><span class="p">[</span><span class="m">1</span><span class="p">],</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="p">}</span>
<span class="p">)</span></code></pre>
</div>
</div>
</div>
</details>
<div class="paragraph">
<p>Would then serialize as (in hex):</p>
</div>
<details>
<summary class="title">Annotated Hex</summary>
<div class="content">
<div class="listingblock">
<div class="content">
<pre class="rouge highlight"><code data-lang="text">// RESPONSE (Complex)
06 // HDR:RESPSTART (Status: OK)
1b // HDR:CKSUM
d0ba719f // Checksum Value (3501879711)
01 // HDR:MSGSTART
00000001 // Protocol Version (1)
02 // HDR:BODYSTART
00000002 // Record Group Count (2)
00000198 // Record Groups Size (408)
// Record Group 1 (204)
00000002 // Record Count (2)
000000c4 // Record Group Size (196)
// Record Group 1, Record 1 (98 bytes)
00000001 // Field/Value Count (1)
0000001e // Record Size (30)
00000038 // Request Record Size (56)
// Record Group 1, Record 1, Field/Value 1 (30 bytes)
00000006 // Field Name Size (6)
00000010 // Field Value Size (16)
646174614131 // "dataA1"
3c6172626974726172792064 // "&lt;arbitrary data&gt;"
6174613e
// Record Group 1, Record 1 (REQUEST RECORD) (56 bytes)
00000002 // Field/Value Count (2)
00000030 // Record Size (48)
// Record Group 1, Record 1, Field/Value 1 (24 bytes)
00000008 // Field Name Size (8)
00000008 // Field Value Size (8)
6669656c64413141 // "fieldA1A"
76616c7565413141 // "valueA1A"
// Record Group 1, Record 1, Field/Value 2 (24 bytes)
00000008 // Field Name Size (8)
00000008 // Field Value Size (8)
6669656c64413142 // "fieldA1B"
76616c7565413142 // "valueA1B"
// Record Group 1, Record 2 (98 bytes)
00000001 // Field/Value Count (1)
0000001e // Record Size (30)
00000038 // Request Record Size (56)
// Record Group 1, Record 2, Field/Value 1 (30 bytes)
00000006 // Field Name Size (6)
00000010 // Field Value Size (16)
646174614132 // "dataA2"
3c6172626974726172792064 // "&lt;arbitrary data&gt;"
6174613e
// Record Group 1, Record 2 (REQUEST RECORD) (56 bytes)
00000002 // Field/Value Count (2)
00000030 // Record Size (48)
// Record Group 1, Record 2, Field/Value 1 (24 bytes)
00000008 // Field Name Size (8)
00000008 // Field Value Size (8)
6669656c64413241 // "fieldA2A"
76616c7565413241 // "valueA2A"
// Record Group 1, Record 2, Field/Value 2 (24 bytes)
00000008 // Field Name Size (8)
00000008 // Field Value Size (8)
6669656c64413242 // "fieldA2B"
76616c7565413242 // "valueA2B"
// Record Group 2 (204)
00000002 // Record Count (2)
000000c4 // Record Group Size (196)
// Record Group 2, Record 1 (98 bytes)
00000001 // Field/Value Count (1)
0000001e // Record Size (30)
00000038 // Request Record Size (56)
// Record Group 2, Record 1, Field/Value 1 (30 bytes)
00000006 // Field Name Size (6)
00000010 // Field Value Size (16)
646174614231 // "dataB1"
3c6172626974726172792064 // "&lt;arbitrary data&gt;"
6174613e
// Record Group 2, Record 1 (REQUEST RECORD) (56 bytes)
00000002 // Field/Value Count (2)
00000030 // Record Size (48)
// Record Group 2, Record 1, Field/Value 1 (24 bytes)
00000008 // Field Name Size (8)
00000008 // Field Value Size (8)
6669656c64423141 // "fieldB1A"
76616c7565423141 // "valueB1A"
// Record Group 2, Record 1, Field/Value 2 (24 bytes)
00000008 // Field Name Size (8)
00000008 // Field Value Size (8)
6669656c64423142 // "fieldB1B"
76616c7565423142 // "valueB1B"
// Record Group 2, Record 2 (98 bytes)
00000001 // Field/Value Count (1)
0000001e // Record Size (30)
00000038 // Request Record Size (56)
// Record Group 2, Record 2, Field/Value 1 (30 bytes)
00000006 // Field Name Size (6)
00000010 // Field Value Size (16)
646174614232 // "dataB2"
3c6172626974726172792064 // "&lt;arbitrary data&gt;"
6174613e
// Record Group 2, Record 2 (REQUEST RECORD) (56 bytes)
00000002 // Field/Value Count (2)
00000030 // Record Size (48)
// Record Group 2, Record 2, Field/Value 1 (24 bytes)
00000008 // Field Name Size (8)
00000008 // Field Value Size (8)
6669656c64423241 // "fieldB2A"
76616c7565423241 // "valueB2A"
// Record Group 2, Record 2, Field/Value 2 (24 bytes)
00000008 // Field Name Size (8)
00000008 // Field Value Size (8)
6669656c64423242 // "fieldB2B"
76616c7565423242 // "valueB2B"
03 // HDR:BODYEND
04 // HDR:MSGEND</code></pre>
</div>
</div>
</div>
</details>
<div class="paragraph">
<p>Or, non-annotated:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="rouge highlight"><code data-lang="text">061bd0ba719f010000000102000000020000019800000002000000c4000000010000001e00000038
00000006000000106461746141313c61726269747261727920646174613e00000002000000300000
0008000000086669656c6441314176616c756541314100000008000000086669656c644131427661
6c7565413142000000010000001e0000003800000006000000106461746141323c61726269747261
727920646174613e000000020000003000000008000000086669656c6441324176616c7565413241
00000008000000086669656c6441324276616c756541324200000002000000c4000000010000001e
0000003800000006000000106461746142313c61726269747261727920646174613e000000020000
003000000008000000086669656c6442314176616c756542314100000008000000086669656c6442
314276616c7565423142000000010000001e0000003800000006000000106461746142323c617262
69747261727920646174613e000000020000003000000008000000086669656c6442324176616c75
6542324100000008000000086669656c6442324276616c75654232420304</code></pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="footnotes">
<hr>
<div class="footnote" id="_footnotedef_1">
<a href="#_footnoteref_1">1</a>. Response messages only.
</div>
<div class="footnote" id="_footnotedef_2">
<a href="#_footnoteref_2">2</a>. Optional for Request.
</div>
<div class="footnote" id="_footnotedef_3">
<a href="#_footnoteref_3">3</a>. Required for Response.
</div>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2024-07-07 23:31:43 -0400
</div>
</div>
</body>
</html>