-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathscheme.tex
131 lines (105 loc) · 4.33 KB
/
scheme.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
\documentclass[11pt]{article}
\usepackage{float}
\title{XYO Network Object Model}
\date{November, 2018}
\begin{document}
\maketitle
\section{Overview}
Everything that is encoded is a superset of an \textit{Object}. An object is defined by having an object header that contains information about how to unpack that object. This information includes how to read the size of the object, if the object is Iterable (typed and untyped), and the ID of the object.
\section{Object Structure}
\begin{center}
\begin{tabular}{ |l|l| }
\hline
\textbf{Name} & \textbf{Description}\\
\hline
Object Header & Info about the object and size \\
Size & Size of the object \\
Payload & The raw contents of the object. \\
\hline
\end{tabular}
\end{center}
\section{Object Header}
The object header is prepended to every object to obtain information about the object. This is broken into two primary sections, the encoding catalogue and ID.
\begin{center}
\begin{tabular}{ |l|l| }
\hline
\textbf{Name} & \textbf{Size}\\
\hline
Encoding catalogue & 1 Byte. \\
ID & 1 Byte. \\
\hline
\end{tabular}
\end{center}
\subsection{Encoding catalogue (1 Byte)}
The encoding catalogue gives information about the size of the size and if the object is Iterable (typed and untyped).
\subsubsection{Structure}
\begin{center}
\begin{tabular}{ |l|l| }
\hline
\textbf{Size} & \textbf{Name}\\
\hline
2 bits & Size identifier size \\
1 bit & Is Iterable \\
1 bit & Is a typed iterable \\
4 bits & Reserved for future use \\
\hline
\end{tabular}
\end{center}
\subsubsection{Size identifier size (2 bits)}
These two bits are used to determine how many bytes to read to obtain the size of the object after the header of the object. The states of the Size identifier size flags are listed below. Note: \textit{All sizes include themes, are big endian, and are unsigned.}.
\begin{center}
\begin{tabular}{ |l|l| }
\hline
\textbf{Flag} & \textbf{Name}\\
\hline
00b & 1 Byte Size. \\
01b & 2 Byte Size. \\
10b & 4 Byte Size. \\
11b & 8 Byte Size. \\
\hline
\end{tabular}
\end{center}
\subsubsection{Is Iterable}
This flag is the 3rd most significant bit. If the bit is set, the following object after the object header will be Iterable.
\subsection{Is a typed iterable}
This flag is the 4rd most significant bit. If the bit is set, the following Iterable object will only contain one header for all items in the set. For more information refer to the Iterable objects section.
\subsection{ID (1 Byte)}
Used as a ID for the value/payload. This value is appended to the Encoding catalogue.
\section{Iterable Objects}
Iterable Objects are objects that contain a set of child objetcs. If an object is iterable, the proper flag will be set in the object header. There are two types of iterable objects: typed iterable objects, and untyped Iterable Objects. If an iterable is typed, the proper flag will be set in the object header.
\subsection{Untyped Iterable Objects}
Untyped Iterable Objects are objects that contain a set of objects that have more than one type of header. Untyped iterable objects are created by concatenating many objects together that share one header.
\subsubsection{Example Structure}
\begin{center}
\begin{tabular}{ |l|l| }
\hline
\textbf{Name} & \textbf{Description}\\
\hline
Encoding catalogue & Encoding catalogue for entire set. \\
ID & ID for entire set. \\
Size & Size of entire set. \\
Object 0 (With header) & The first element in the set. \\
Object 1 (With header) & The second element on the set. \\
Object n (With header) & The n'th object in the set. \\
\hline
\end{tabular}
\end{center}
\subsection{Typed Iterable Objects}
Typed Iterable Objects are objects that contain a set of objects that all share the same header. Typed iterable objects are created by concatenating many objects without their header together and prepending it with the shared header.
\subsubsection{Example Structure}
\begin{center}
\begin{tabular}{ |l|l| }
\hline
\textbf{Name} & \textbf{Description}\\
\hline
Encoding catalogue & Encoding catalogue for entire set. \\
ID & ID for entire set. \\
Size & Size of entire set. \\
Shared Header & The header the objects 0-n share. \\
Object 0 (No header) & The first element in the set. \\
Object 1 (No header) & The second element on the set. \\
Object n (No header) & The n'th object in the set. \\
\hline
\end{tabular}
\end{center}
\end{document}