**** Merged from MCS ****
[mono-project.git] / mcs / class / corlib / System.Runtime.Serialization.Formatters.Binary / binary_serialization_format.htm
blob6b85a406f8bc4d0ec61554a94f5039ba62093639
1 <html>
2 <head>
3 <title>Binary Serialization Format</title>
4 <style> body { FONT-SIZE: x-small; FONT-FAMILY: arial }
5 table { FONT-SIZE: x-small; FONT-FAMILY: arial }
6 </style>
7 </head>
8 <body>
9 <H1>Binary Serialization Format</H1>
10 <P>by Lluis Sanchez Gual&nbsp;(<A href="mailto:lluis@ideary.com">lluis@ideary.com</A>)</P>
11 <UL>
12 <LI>
13 <A href="#intro">Introduction</A>
14 <LI>
15 <A href="#format">Format description</A>
16 <UL>
17 <LI>
18 <A href="#example">An example</A></LI></UL>
19 <LI>
20 <A href="#elements">Binary elements</A>
21 <UL>
22 <LI>
23 <A href="#elem1">1 - RefTypeObject</A>
24 <LI>
25 <A href="#elem4">4 - RuntimeObject</A>
26 <LI>
27 <A href="#elem5">5 - ExternalObject</A>
28 <LI>
29 <A href="#elem6">6 - String</A>
30 <LI>
31 <A href="#elem7">7 - GenericArray</A>
32 <LI>
33 <A href="#elem8">8 - BoxedPrimitiveTypeValue</A>
34 <LI>
35 <A href="#elem9">9 - ObjectReference</A>
36 <LI>
37 <A href="#elem10">10 - NullValue</A>
38 <LI>
39 <A href="#elem11">11 - End</A>
40 <LI>
41 <A href="#elem12">12 - Assembly</A>
42 <LI>
43 <A href="#elem13">13 - ArrayFiller8b</A>
44 <LI>
45 <A href="#elem14">14 - ArrayFiller32b</A>
46 <LI>
47 <A href="#elem15">15 - ArrayOfPrimitiveType</A>
48 <LI>
49 <A href="#elem16">16 - ArrayOfObject</A>
50 <LI>
51 <A href="#elem17">17 - ArrayOfString</A>
52 <LI>
53 <A href="#elem21">21 - MethodCall</A>
54 <LI>
55 <A href="#elem22">22 - MethodResponse</A></LI></UL>
56 <LI>
57 <A href="#other">Other Elements</A>
58 </LI>
59 <UL>
60 <LI>
61 <A href="#string">string</A>
62 <LI>
63 <A href="#primitive-value">primitive-value</A>
64 <LI>
65 <A href="#value">value</A>
66 <LI>
67 <A href="#type-tag">type-tag</A>
68 <LI>
69 <A href="#type-spec">type-spec</A>
70 <LI>
71 <A href="#method-call-flags">method-call-flags</A>
72 <LI>
73 <A href="#method-response-flags">method-response-flags</A>
74 <LI>
75 <A href="#return-type-tag">return-type-tag</A>
76 <LI>
77 <A href="#primitive-type-code">primitive-type-code</A></LI></UL>
78 </UL>
79 <a name="intro"></a>
80 <H2>Introduction</H2>
81 <P>This document describes the format used by the class BinaryFormatter to
82 serialize object graphs. The document is based on the analysis of the output of
83 the BinaryFormatter&nbsp;of the Microsoft .NET runtime, so it is probably not
84 complete, since I cannot be sure that I have tested all cases. In fact, there
85 are some gaps in some tables of codes, so if you find a meaning for the missing
86 codes, please contact me and I'll update the document.</P>
87 <a name="format"></a>
88 <H2>Format description</H2>
89 <P>An object serialization is a sequence of binary elements.&nbsp;A binary element
90 coluld be for example a description of an object, an array, an assembly, etc.
91 Each binary element has a specific format, which is described in the following
92 sections.</P>
93 <P>This table shows the available binary elements:</P>
94 <P>
95 <TABLE id="Table1" style="WIDTH: 560px; HEIGHT: 94px" cellSpacing="1" cellPadding="1" width="560" border="1">
96 <TR>
97 <TD width="40"><STRONG>Code</STRONG></TD>
98 <TD><STRONG>Label</STRONG></TD>
99 <TD><STRONG>Description</STRONG></TD>
100 </TR>
101 <TR>
102 <TD width="40">0</TD>
103 <TD>Header</TD>
104 <TD>Allways written at the beggining of a serialization</TD>
105 </TR>
106 <TR>
107 <TD width="40">1</TD>
108 <TD><A href="#elem1">RefTypeObject</A></TD>
109 <TD>Object with no type metadata</TD>
110 </TR>
111 <TR>
112 <TD width="40">4</TD>
113 <TD><A href="#elem4">RuntimeObject</A></TD>
114 <TD>Corlib object</TD>
115 </TR>
116 <TR>
117 <TD width="40">5</TD>
118 <TD><A href="#elem5">ExternalObject</A></TD>
119 <TD>Object</TD>
120 </TR>
121 <TR>
122 <TD width="40">6</TD>
123 <TD><A href="#elem6">String</A></TD>
124 <TD>String</TD>
125 </TR>
126 <TR>
127 <TD width="40">7</TD>
128 <TD><A href="#elem7">GenericArray</A></TD>
129 <TD>Array</TD>
130 </TR>
131 <TR>
132 <TD width="40">8</TD>
133 <TD><A href="#elem8">BoxedPrimitiveTypeValue</A></TD>
134 <TD>Primitive type value</TD>
135 </TR>
136 <TR>
137 <TD width="40">9</TD>
138 <TD><A href="#elem9">ObjectReference</A></TD>
139 <TD>Object reference</TD>
140 </TR>
141 <TR>
142 <TD width="40">10</TD>
143 <TD><A href="#elem10">NullValue</A></TD>
144 <TD>Null value</TD>
145 </TR>
146 <TR>
147 <TD width="40">11</TD>
148 <TD><A href="#elem11">End</A></TD>
149 <TD>End of stream</TD>
150 </TR>
151 <TR>
152 <TD width="40">12</TD>
153 <TD><A href="#elem12">Assembly</A></TD>
154 <TD>Assembly declaration</TD>
155 </TR>
156 <TR>
157 <TD width="40">13</TD>
158 <TD><A href="#elem13">ArrayFiller8b</A></TD>
159 <TD>Null filler (8 bit length)</TD>
160 </TR>
161 <TR>
162 <TD width="40">14</TD>
163 <TD><A href="#elem14">ArrayFiller32b</A></TD>
164 <TD>Null filler (16 bit length)</TD>
165 </TR>
166 <TR>
167 <TD width="40">15</TD>
168 <TD><A href="#elem15">ArrayOfPrimitiveType</A></TD>
169 <TD>Array of primitive type</TD>
170 </TR>
171 <TR>
172 <TD width="40">16</TD>
173 <TD><A href="#elem16">ArrayOfObject</A></TD>
174 <TD>Array of Object</TD>
175 </TR>
176 <TR>
177 <TD width="40">17</TD>
178 <TD><A href="#elem17">ArrayOfString</A></TD>
179 <TD>Array of string</TD>
180 </TR>
181 <TR>
182 <TD width="40">21</TD>
183 <TD><A href="#elem21">MethodCall</A></TD>
184 <TD>Method call</TD>
185 </TR>
186 <TR>
187 <TD width="40">22</TD>
188 <TD><A href="#elem22">MethodResponse</A></TD>
189 <TD>Method response</TD>
190 </TR>
191 </TABLE>
192 </P>
193 <P>All elements begin with a byte that identifies the type of element. It is shown
194 in the "Code" column. In the implementation of the formatter I use an enum to
195 represent those codes. The "Label" column is the name of the corresponding enum
196 element.</P>
197 <a name="example"></a>
198 <H3>An example</H3>
199 <P>The best way to underestand the format is to look at an example. Let's see how
200 the following structure of classes would be serialized:</P>
201 <BLOCKQUOTE dir="ltr" style="MARGIN-RIGHT: 0px">
202 <P><FONT face="Courier New">class A<BR>
203 {<BR>
204 &nbsp;&nbsp;&nbsp;&nbsp; B bval = new B();<BR>
205 &nbsp;&nbsp;&nbsp;&nbsp; C cval = new C();<BR>
206 &nbsp;&nbsp;&nbsp;&nbsp; string msg = "hello";<BR>
207 }<BR>
208 <BR>
209 class B<BR>
210 {<BR>
211 &nbsp;&nbsp;&nbsp;&nbsp; string str = "bye";<BR>
212 }<BR>
213 <BR>
214 struct C<BR>
215 {<BR>
216 &nbsp;&nbsp;&nbsp;&nbsp; string[] info = new string[] {"hello","world"}<BR>
217 }</FONT></P>
218 </BLOCKQUOTE>
219 <P>The serialization of an instance of class A would result in a sequence of binary
220 elements like the following:</P>
222 <TABLE id="Table35" cellSpacing="1" cellPadding="1" width="100%" border="1">
223 <TR>
224 <TD vAlign="top" width="169"><STRONG>Element</STRONG></TD>
225 <TD vAlign="top" width="40"><STRONG>Bytes</STRONG></TD>
226 <TD vAlign="top" width="186"><STRONG>Data</STRONG></TD>
227 <TD vAlign="top"><STRONG>Comments</STRONG></TD>
228 </TR>
229 <TR>
230 <TD vAlign="top" width="169">Header</TD>
231 <TD vAlign="top" width="40">0<BR>
232 1,0,0,0,<BR>
233 255,255,255,255,<BR>
234 1,0,0,0,0,0,0,0</TD>
235 <TD vAlign="top" width="186">Element code ?</TD>
236 <TD vAlign="top">This sequence of bytes is serialized at the beginning. I'm sure it
237 has a meaning, but I don't know it.</TD>
238 </TR>
239 <TR>
240 <TD vAlign="top" width="169"><A href="#elem12">Assembly</A></TD>
241 <TD vAlign="top" width="40">1<BR>
242 1,0,0,0<BR>
243 "MyAssembly"</TD>
244 <TD vAlign="top" width="186">Element code<BR>
245 ID of the assembly (1)<BR>
246 Full name of the assembly</TD>
247 <TD vAlign="top">
248 <P>Before serializing an object, the assembly where the object is implemented has
249 to be serialized. The formatter assigns an ID to the assembly (ID 1 in this
250 case). This ID will by used to refer to this assembly.</P>
251 </TD>
252 </TR>
253 <TR>
254 <TD vAlign="top" width="169"><A href="#elem5">ExternalObject</A></TD>
255 <TD vAlign="top" width="40">5<BR>
256 2,0,0,0<BR>
257 "A"<BR>
258 3,0,0,0<BR>
259 "bval","cval","msg"<BR>
260 4,4,1<BR>
261 "B"<BR>
262 1,0,0,0<BR>
263 "C"<BR>
264 1,0,0,0<BR>
265 1,0,0,0</TD>
266 <TD vAlign="top" width="186">Element code<BR>
267 Object ID (2)<BR>
268 Class name<BR>
269 Field count<BR>
270 Field names<BR>
271 Field type tags<BR>
272 Class name of field "bval"<BR>
273 Assembly ID of field "bval"<BR>
274 Class name of field "cval"<BR>
275 Assembly ID of field "cval"<BR>
276 Assembly ID of this object</TD>
277 <TD vAlign="top">Serialization of the root object. Each object has an ID that is
278 used, for example, to specify object relations. The object binary element has
279 two parts. The first one is type metadata: the name and type of serialized
280 fields. The second part is the object data: field values. The data part is
281 shown in the following nested elements.</TD>
282 </TR>
283 <TR>
284 <TD vAlign="top" width="169">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href="#elem9">ObjectReference</A></TD>
285 <TD vAlign="top" width="40">9<BR>
286 5,0,0,0</TD>
287 <TD vAlign="top" width="186">Element code<BR>
288 ID of the referred object (5)</TD>
289 <TD vAlign="top">Reference objects are not serialized inside the container element.
290 Instead, an ObjectReference is serialized, and the object itself queued for
291 later serialization.</TD>
292 </TR>
293 <TR>
294 <TD vAlign="top" width="169">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href="#elem5">ExternalObject</A></TD>
295 <TD vAlign="top" width="40">5<BR>
296 3,0,0,0<BR>
297 C<BR>
298 1,0,0,0<BR>
299 "info"<BR>
300 6<BR>
301 1,0,0,0</TD>
302 <TD vAlign="top" width="186">Element code<BR>
303 Object ID (3)<BR>
304 Class name<BR>
305 Field count<BR>
306 Field name<BR>
307 Field type tag<BR>
308 Assembly ID of this object</TD>
309 <TD vAlign="top">On the other hand, value type objects are serialized inside the
310 container element.</TD>
311 </TR>
312 <TR>
313 <TD vAlign="top" width="169">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
314 <A href="#elem9">ObjectReference</A></TD>
315 <TD vAlign="top" width="40">9<BR>
316 7,0,0,0</TD>
317 <TD vAlign="top" width="186">Element code<BR>
318 ID of the referred object (7)</TD>
319 <TD vAlign="top">This is again a reference object, so it is serialized later.</TD>
320 </TR>
321 <TR>
322 <TD vAlign="top" width="169">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href="#elem6">String</A></TD>
323 <TD vAlign="top" width="40">6<BR>
324 4,0,0,0<BR>
325 "hello"</TD>
326 <TD vAlign="top" width="186">Element code<BR>
327 Object ID (4)<BR>
328 String value</TD>
329 <TD vAlign="top">Strings are serialized like value objects</TD>
330 </TR>
331 <TR>
332 <TD vAlign="top" width="169"><A href="#elem5">ExternalObject</A></TD>
333 <TD vAlign="top" width="40">5<BR>
334 5,0,0,0<BR>
335 "B"<BR>
336 1,0,0,0<BR>
337 "str"<BR>
338 1<BR>
339 1,0,0,0</TD>
340 <TD vAlign="top" width="186">Element code<BR>
341 Object ID (5)<BR>
342 Class name<BR>
343 Field count<BR>
344 Field name<BR>
345 Field type tag<BR>
346 Assembly ID of this object</TD>
347 <TD vAlign="top">
348 <P>Reference objects queued for serialization are serialized after the root object.</P>
349 </TD>
350 </TR>
351 <TR>
352 <TD vAlign="top" width="169">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A href="#elem6">String</A></TD>
353 <TD vAlign="top" width="40">6<BR>
354 6,0,0,0<BR>
355 "bye"</TD>
356 <TD vAlign="top" width="186">Element code<BR>
357 Object ID (6)<BR>
358 String value</TD>
359 <TD vAlign="top">A string</TD>
360 </TR>
361 <TR>
362 <TD vAlign="top" width="169"><A href="#elem17">ArrayOfString</A></TD>
363 <TD vAlign="top" width="40">17<BR>
364 7,0,0,0<BR>
365 2,0,0,0</TD>
366 <TD vAlign="top" width="186">Element code<BR>
367 Object ID (7)<BR>
368 Element count</TD>
369 <TD vAlign="top">This could be also encoded using the binary&nbsp;element Array
370 (7), but ArrayOfString is more specific and saves bytes.</TD>
371 </TR>
372 <TR>
373 <TD vAlign="top" width="169">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href="#elem9">ObjectReference</A></TD>
374 <TD vAlign="top" width="40">9<BR>
375 4,0,0,0</TD>
376 <TD vAlign="top" width="186">Element code<BR>
377 ID of the referred object (4)</TD>
378 <TD vAlign="top">This string was already serialized. Use a backwards reference.</TD>
379 </TR>
380 <TR>
381 <TD vAlign="top" width="169">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href="#elem6">String</A></TD>
382 <TD vAlign="top" width="40">6<BR>
383 8,0,0,0<BR>
384 "world"</TD>
385 <TD vAlign="top" width="186">Element code<BR>
386 Object ID (8)<BR>
387 String value</TD>
388 <TD vAlign="top">Another string</TD>
389 </TR>
390 </TABLE>
391 </P>
392 <a name="elements"></a>
393 <H2>Binary elements</H2>
394 <P>The following sections show the format of each binary element. The format is
395 presented in a table with two columns. The first one shows the sequence of
396 bytes and the second one a description of each element in the sequence.</P>
397 <P>A special notation is used to represent the bytes. Here are some examples:</P>
399 <TABLE id="Table36" style="WIDTH: 448px; HEIGHT: 129px" cellSpacing="1" cellPadding="1" width="448" border="1">
400 <TR>
401 <TD width="193"><STRONG>Example of element</STRONG></TD>
402 <TD><STRONG>Description</STRONG></TD>
403 </TR>
404 <TR>
405 <TD width="193">(byte) 7</TD>
406 <TD>A single byte</TD>
407 </TR>
408 <TR>
409 <TD width="193">uint</TD>
410 <TD>Any uint value (4 bytes)</TD>
411 </TR>
412 <TR>
413 <TD width="193"><EM><A href="#type-tag">type-tag</A></EM></TD>
414 <TD>Names&nbsp;in italic are described in the section "Other elements"</TD>
415 </TR>
416 <TR>
417 <TD width="193"><EM><A href="#string">string</A></EM>&nbsp;*</TD>
418 <TD>* represents a sequence of elements</TD>
419 </TR>
420 <TR>
421 <TD width="193">object</TD>
422 <TD>Full serialization of an object</TD>
423 </TR>
424 </TABLE>
425 </P>
426 <a name="elem1"></a>
427 <H3>1 - RefTypeObject
428 </H3>
429 <P>An object is serialized in two parts. The first one is type metadata, and the
430 second one is the object data. When several objects of the same type are
431 serialized, only the first one has the metadata part. The other objects are
432 serialized using the RefTypeObject element, which instead of the metadata, it
433 includes an ID of an object that is of the same type as the one being
434 serialized.</P>
436 <TABLE id="Table2" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
437 <TR>
438 <TD width="142"><STRONG>Element</STRONG></TD>
439 <TD><STRONG>Description</STRONG></TD>
440 </TR>
441 <TR>
442 <TD width="142">(byte) 1</TD>
443 <TD>Element code</TD>
444 </TR>
445 <TR>
446 <TD width="142">uint</TD>
447 <TD>Object ID</TD>
448 </TR>
449 <TR>
450 <TD width="142">uint</TD>
451 <TD>ID of a previously serialized object from which to take type metadata.</TD>
452 </TR>
453 <TR>
454 <TD width="142"><EM><A href="#value">value</A> </EM>*</TD>
455 <TD>Values of the fields of the object</TD>
456 </TR>
457 </TABLE>
458 </P>
459 <a name="elem4"></a>
460 <H3>4 - RuntimeObject</H3>
461 <P>This element is used to serialize objects of types that are implemented in the
462 core library of the framework. The only difference from the format for other
463 objects if that it does not include assembly information, which is not needed
464 since the assembly will always be mscorlib.</P>
466 <TABLE id="Table21" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
467 <TR>
468 <TD width="142"><STRONG>Element</STRONG></TD>
469 <TD><STRONG>Description</STRONG></TD>
470 </TR>
471 <TR>
472 <TD width="142">(byte) 4</TD>
473 <TD>Element code</TD>
474 </TR>
475 <TR>
476 <TD width="142">uint</TD>
477 <TD>Object ID</TD>
478 </TR>
479 <TR>
480 <TD width="142"><EM><A href="#string">string</A></EM></TD>
481 <TD>Class name, including namespace</TD>
482 </TR>
483 <TR>
484 <TD width="142">uint</TD>
485 <TD>Number of serialized fields</TD>
486 </TR>
487 <TR>
488 <TD width="142"><EM><A href="#string">string</A> </EM>*</TD>
489 <TD>Names of the fields</TD>
490 </TR>
491 <TR>
492 <TD width="142"><EM><A href="#type-tag">type-tag</A> *</EM></TD>
493 <TD>type-tag of each field</TD>
494 </TR>
495 <TR>
496 <TD width="142"><EM><A href="#type-spec">type-spec</A> *</EM></TD>
497 <TD>type-spec of each field</TD>
498 </TR>
499 <TR>
500 <TD width="142"><EM><A href="#value">value</A> *</EM></TD>
501 <TD>Values of the fields of the object</TD>
502 </TR>
503 </TABLE>
504 </P>
505 <a name="elem5"></a>
506 <H3>5 - ExternalObject</H3>
507 <P>This element can be used to serialize any object from any assembly.</P>
508 <H3>
509 <TABLE id="Table22" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
510 <TR>
511 <TD width="142"><STRONG>Element</STRONG></TD>
512 <TD><STRONG>Description</STRONG></TD>
513 </TR>
514 <TR>
515 <TD width="142">(byte) 5</TD>
516 <TD>Element code</TD>
517 </TR>
518 <TR>
519 <TD width="142">uint</TD>
520 <TD>Object ID</TD>
521 </TR>
522 <TR>
523 <TD width="142"><EM><A href="#string">string</A></EM></TD>
524 <TD>Class name, including namespace</TD>
525 </TR>
526 <TR>
527 <TD width="142">uint</TD>
528 <TD>Number of serialized fields</TD>
529 </TR>
530 <TR>
531 <TD width="142"><EM><A href="#string">string</A> </EM>*</TD>
532 <TD>Names of the fields</TD>
533 </TR>
534 <TR>
535 <TD width="142"><EM><A href="#type-tag">type-tag</A> </EM>*</TD>
536 <TD>type-tag of each field</TD>
537 </TR>
538 <TR>
539 <TD width="142"><EM><A href="#type-spec">type-spec</A> </EM>*</TD>
540 <TD>type-spec of each field</TD>
541 </TR>
542 <TR>
543 <TD width="142">uint</TD>
544 <TD>ID of the assembly where the class is defined (the assembly must have been
545 serialized before the class using the binary element 12)</TD>
546 </TR>
547 <TR>
548 <TD width="142"><EM><A href="#value">value</A> </EM>*</TD>
549 <TD>Values of the fields of the object</TD>
550 </TR>
551 </TABLE>
552 </H3>
553 <a name="elem6"></a>
554 <H3>6 - String</H3>
555 <P>A string value.</P>
557 <TABLE id="Table23" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
558 <TR>
559 <TD width="142"><STRONG>Element</STRONG></TD>
560 <TD><STRONG>Description</STRONG></TD>
561 </TR>
562 <TR>
563 <TD width="142">(byte) 6</TD>
564 <TD>Element code</TD>
565 </TR>
566 <TR>
567 <TD width="142">uint</TD>
568 <TD>Object ID</TD>
569 </TR>
570 <TR>
571 <TD width="142"><EM><A href="#string">string</A></EM></TD>
572 <TD>Value of the string</TD>
573 </TR>
574 </TABLE>
575 </P>
576 <a name="elem7"></a>
577 <H3>7 - GenericArray</H3>
578 <P>This element can be used to represent any array.</P>
579 <H3>
580 <TABLE id="Table24" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
581 <TR>
582 <TD width="142"><STRONG>Element</STRONG></TD>
583 <TD><STRONG>Description</STRONG></TD>
584 </TR>
585 <TR>
586 <TD width="142">(byte) 7</TD>
587 <TD>Element code</TD>
588 </TR>
589 <TR>
590 <TD width="142">uint</TD>
591 <TD>Object ID</TD>
592 </TR>
593 <TR>
594 <TD width="142">byte</TD>
595 <TD>Array type: 0:single dimension, 1: jagged, 2: multi-dimensional</TD>
596 </TR>
597 <TR>
598 <TD width="142">uint</TD>
599 <TD>Number of dimensions (rank)</TD>
600 </TR>
601 <TR>
602 <TD width="142">uint *</TD>
603 <TD>Number of&nbsp;elements for each dimension</TD>
604 </TR>
605 <TR>
606 <TD width="142"><EM><A href="#type-tag">type-tag</A></EM></TD>
607 <TD>type-tag of array's&nbsp;element type</TD>
608 </TR>
609 <TR>
610 <TD width="142"><EM><A href="#type-spec">type-spec</A></EM></TD>
611 <TD>type-spec of array's&nbsp;element type</TD>
612 </TR>
613 <TR>
614 <TD width="142"><EM><A href="#value">value</A> *</EM></TD>
615 <TD>Values of the elements, row by row</TD>
616 </TR>
617 </TABLE>
618 </H3>
619 <a name="elem8"></a>
620 <H3>8 - BoxedPrimitiveTypeValue</H3>
621 <P>This element represents a primitive type value boxed as an object.</P>
623 <TABLE id="Table25" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
624 <TR>
625 <TD width="142"><STRONG>Element</STRONG></TD>
626 <TD><STRONG>Description</STRONG></TD>
627 </TR>
628 <TR>
629 <TD width="142">(byte) 8</TD>
630 <TD>Element code</TD>
631 </TR>
632 <TR>
633 <TD width="142"><EM><A href="#type-spec">type-spec</A></EM></TD>
634 <TD>type-spec of the primitive type</TD>
635 </TR>
636 <TR>
637 <TD width="142"><EM><A href="#primitive-value">primitive-value</A></EM></TD>
638 <TD>Raw value</TD>
639 </TR>
640 </TABLE>
641 </P>
642 <a name="elem9"></a>
643 <H3>9 - ObjectReference</H3>
644 <P>This element represents a reference to an object already serialized (backwards
645 reference) or that will be serialized later (forward reference).
646 </P>
648 <TABLE id="Table26" style="WIDTH: 568px; HEIGHT: 16px" cellSpacing="1" cellPadding="1" width="568" border="1">
649 <TR>
650 <TD width="142"><STRONG>Element</STRONG></TD>
651 <TD><STRONG>Description</STRONG></TD>
652 </TR>
653 <TR>
654 <TD width="142">(byte) 9</TD>
655 <TD>Element code</TD>
656 </TR>
657 <TR>
658 <TD width="142">uint</TD>
659 <TD>ID of the referred object</TD>
660 </TR>
661 </TABLE>
662 </P>
663 <a name="elem10"></a>
664 <H3>10 - NullValue</H3>
665 <P>A&nbsp;null value.</P>
666 <TABLE id="Table27" style="WIDTH: 568px; HEIGHT: 16px" cellSpacing="1" cellPadding="1" width="568" border="1">
667 <TR>
668 <TD width="142"><STRONG>Element</STRONG></TD>
669 <TD><STRONG>Description</STRONG></TD>
670 </TR>
671 <TR>
672 <TD width="142">(byte) 10</TD>
673 <TD>Element code</TD>
674 </TR>
675 </TABLE>
676 <P></P>
677 <a name="elem11"></a>
678 <H3>
679 <P>11 - End</P>
680 </H3>
681 <P>This element marks the end of the serialized object graph.</P>
682 <TABLE id="Table28" style="WIDTH: 568px; HEIGHT: 16px" cellSpacing="1" cellPadding="1" width="568" border="1">
683 <TR>
684 <TD width="142"><STRONG>Element</STRONG></TD>
685 <TD><STRONG>Description</STRONG></TD>
686 </TR>
687 <TR>
688 <TD width="142">(byte) 11</TD>
689 <TD>Element code</TD>
690 </TR>
691 </TABLE>
692 <a name="elem12"></a>
693 <H3>
694 <P>12 - Assembly</P>
695 </H3>
696 <P>Defines an assembly. Each assembly is defined only once and has an ID. This ID
697 is used when serializing an object (element 5) to specify the assembly where
698 object's type is implemented.</P>
699 <TABLE id="Table29" style="WIDTH: 568px; HEIGHT: 16px" cellSpacing="1" cellPadding="1" width="568" border="1">
700 <TR>
701 <TD width="142"><STRONG>Element</STRONG></TD>
702 <TD><STRONG>Description</STRONG></TD>
703 </TR>
704 <TR>
705 <TD width="142">(byte) 12</TD>
706 <TD>Element code</TD>
707 </TR>
708 <TR>
709 <TD width="142">uint</TD>
710 <TD>Assembly ID</TD>
711 </TR>
712 <TR>
713 <TD width="142"><EM><A href="#string">string</A></EM></TD>
714 <TD>Full name of the assembly</TD>
715 </TR>
716 </TABLE>
717 <a name="elem13"></a>
718 <H3>
719 <P>13 - ArrayFiller8b</P>
720 </H3>
721 <P>This element can be used when serializing array data to specify multiple
722 consecutive null values. It it only used in single dimension arrays of
723 reference objects (not valid for value-type objects).</P>
724 <TABLE id="Table30" style="WIDTH: 568px; HEIGHT: 16px" cellSpacing="1" cellPadding="1" width="568" border="1">
725 <TR>
726 <TD width="142"><STRONG>Element</STRONG></TD>
727 <TD><STRONG>Description</STRONG></TD>
728 </TR>
729 <TR>
730 <TD width="142">(byte) 13</TD>
731 <TD>Element code</TD>
732 </TR>
733 <TR>
734 <TD width="142">byte</TD>
735 <TD>Number of consecutive null values</TD>
736 </TR>
737 </TABLE>
738 <P></P>
739 <a name="elem14"></a>
740 <H3>
741 <P>14 - ArrayFiller32b</P>
742 </H3>
743 <P>The same as ArrayFiller8b, but it uses a uint to specify the length.</P>
744 <TABLE id="Table31" style="WIDTH: 568px; HEIGHT: 16px" cellSpacing="1" cellPadding="1" width="568" border="1">
745 <TR>
746 <TD width="142"><STRONG>Element</STRONG></TD>
747 <TD><STRONG>Description</STRONG></TD>
748 </TR>
749 <TR>
750 <TD width="142">(byte) 14</TD>
751 <TD>Element code</TD>
752 </TR>
753 <TR>
754 <TD width="142">uint</TD>
755 <TD>Number of consecutive null values</TD>
756 </TR>
757 </TABLE>
758 <P></P>
759 <a name="elem15"></a>
760 <H3>
761 <P>15 - ArrayOfPrimitiveType</P>
762 </H3>
763 <P>This element can be used to represent a single dimension array of primitive type
764 values.</P>
766 <TABLE id="Table32" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
767 <TR>
768 <TD width="142"><STRONG>Element</STRONG></TD>
769 <TD><STRONG>Description</STRONG></TD>
770 </TR>
771 <TR>
772 <TD width="142">(byte) 15</TD>
773 <TD>Element code</TD>
774 </TR>
775 <TR>
776 <TD width="142">uint</TD>
777 <TD>Object ID</TD>
778 </TR>
779 <TR>
780 <TD width="142">uint</TD>
781 <TD>Number of&nbsp;elements</TD>
782 </TR>
783 <TR>
784 <TD width="142"><EM><A href="#type-spec">type-spec</A></EM></TD>
785 <TD>type-spec of array's&nbsp;element type</TD>
786 </TR>
787 <TR>
788 <TD width="142"><EM><A href="#primitive-value">primitie-value</A> *</EM></TD>
789 <TD>Values of the elements</TD>
790 </TR>
791 </TABLE>
792 </P>
793 <a name="elem16"></a>
794 <H3>16&nbsp;- ArrayOfObject</H3>
795 <P>This element can be used to represent a single dimension array of Object (i.e.
796 an object[] ).</P>
798 <TABLE id="Table33" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
799 <TR>
800 <TD width="142"><STRONG>Element</STRONG></TD>
801 <TD><STRONG>Description</STRONG></TD>
802 </TR>
803 <TR>
804 <TD width="142">(byte) 16</TD>
805 <TD>Element code</TD>
806 </TR>
807 <TR>
808 <TD width="142">uint</TD>
809 <TD>Object ID</TD>
810 </TR>
811 <TR>
812 <TD width="142">uint</TD>
813 <TD>Number of&nbsp;elements</TD>
814 </TR>
815 <TR>
816 <TD width="142">object *</TD>
817 <TD>Values of the elements</TD>
818 </TR>
819 </TABLE>
820 </P>
821 <a name="elem17"></a>
822 <H3>17 - ArrayOfString</H3>
823 <P>This element can be used to represent a single dimension array of&nbsp;String
824 (i.e. an string[] ).</P>
826 <TABLE id="Table34" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
827 <TR>
828 <TD width="142"><STRONG>Element</STRONG></TD>
829 <TD><STRONG>Description</STRONG></TD>
830 </TR>
831 <TR>
832 <TD width="142">(byte) 17</TD>
833 <TD>Element code</TD>
834 </TR>
835 <TR>
836 <TD width="142">uint</TD>
837 <TD>Object ID</TD>
838 </TR>
839 <TR>
840 <TD width="142">uint</TD>
841 <TD>Number of&nbsp;elements</TD>
842 </TR>
843 <TR>
844 <TD width="142">object *</TD>
845 <TD>Values of the elements</TD>
846 </TR>
847 </TABLE>
848 </P>
849 <a name="elem21"></a>
850 <H3>21 Method call</H3>
851 <P>Represents a method call. The format of a method call can vary depending on the
852 type of the parameters.&nbsp;The following&nbsp;table shows the common format:</P>
854 <TABLE id="Table20" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
855 <TR>
856 <TD width="142"><STRONG>Element</STRONG></TD>
857 <TD><STRONG>Description</STRONG></TD>
858 </TR>
859 <TR>
860 <TD width="142">(byte) 21</TD>
861 <TD>Element code</TD>
862 </TR>
863 <TR>
864 <TD width="142"><EM><A href="#method-call-flags">method-call-flags</A></EM></TD>
865 <TD>Describes wich information includes the method call</TD>
866 </TR>
867 <TR>
868 <TD width="142">(byte) 0, 0, 0</TD>
869 <TD>???</TD>
870 </TR>
871 <TR>
872 <TD width="142"><EM><EM><A href="#type-spec">type-spec</A><BR>
873 <EM><A href="#primitive-value">primitive-value</A></EM></EM></EM></TD>
874 <TD>Method name</TD>
875 </TR>
876 <TR>
877 <TD width="142"><EM><EM><EM><A href="#type-spec">type-spec</A><BR>
878 <EM><A href="#primitive-value">primitive-value</A></EM></EM></EM></EM></TD>
879 <TD>Class name (including namespace and assembly)</TD>
880 </TR>
881 </TABLE>
882 </P>
883 <P>The following tables describe the format of the message content depending on the
884 value of method-call-flags:</P>
885 <H4>method-call-flags &amp; NoArguments</H4>
886 <P>Used for calls to methods without parameters.</P>
887 <H4>
888 <TABLE id="Table8" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
889 <TR>
890 <TD width="119"><STRONG>Element</STRONG></TD>
891 <TD><STRONG>Description</STRONG></TD>
892 </TR>
893 <TR>
894 <TD width="119">Header[]</TD>
895 <TD>Only if there are Headers and method-call-flags has the flag <EM>IncludeLogicalCallContext.
896 </EM>Headers are serialized only if there is context info. This must be a bug
897 in MS.NET.</TD>
898 </TR>
899 <TR>
900 <TD width="119">object[]</TD>
901 <TD>
902 <P>Array with the following values:</P>
903 <UL>
904 <LI>
905 Method signature, only if method-call-flags has the flag IncludesSignature. It
906 is an array of Type.
907 <LI>
908 LogicalCallContext instance, only if method-call-flags has the flag
909 IncludesLogicalCallContext.</LI></UL>
910 <P>If the array is empty, it is not serialized.</P>
911 </TD>
912 </TR>
913 </TABLE>
914 </H4>
915 <H4>method-call-flags &amp; PrimitiveArguments</H4>
916 <P>Used for calls to methods in which all parameters are primitive types.</P>
918 <TABLE id="Table5" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
919 <TR>
920 <TD width="119"><STRONG>Element</STRONG></TD>
921 <TD><STRONG>Description</STRONG></TD>
922 </TR>
923 <TR>
924 <TD width="119">uint</TD>
925 <TD>Number of parameters</TD>
926 </TR>
927 <TR>
928 <TD width="119"><EM><EM><EM><EM>( <A href="#type-spec">type-spec</A></EM></EM></EM><BR>
929 <A href="#primitive-value">primitive-value</A> ) *</EM></TD>
930 <TD>One value for each parameter</TD>
931 </TR>
932 <TR>
933 <TD width="119">Header[]</TD>
934 <TD>Only if there are Headers and method-response-flags has the flag <EM>IncludeLogicalCallContext.
935 </EM>Headers are serialized only if there is context info. This must be a bug
936 in MS.NET.</TD>
937 </TR>
938 <TR>
939 <TD width="119">object[]</TD>
940 <TD>
941 <P>Array with the following values:</P>
942 <UL>
943 <LI>
944 Method signature, only if method-call-flags has the flag IncludesSignature. It
945 is an array of Type.
946 <LI>
947 LogicalCallContext instance, only if method-call-flags has the flag
948 IncludesLogicalCallContext.</LI></UL>
949 <P>If the array is empty, it is not serialized.</P>
950 </TD>
951 </TR>
952 </TABLE>
953 </P>
954 <H4>method-call-flags &amp; ArgumentsInSimpleArray</H4>
955 <P>Used for calls to methods in which at least one parameter is not a primitive
956 type, and when no other info needs to be serialized (i.e. context or
957 signature).</P>
959 <TABLE id="Table6" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
960 <TR>
961 <TD width="119"><STRONG>Element</STRONG></TD>
962 <TD><STRONG>Description</STRONG></TD>
963 </TR>
964 <TR>
965 <TD width="119">Header[]</TD>
966 <TD>Only if there are Headers.</TD>
967 </TR>
968 <TR>
969 <TD width="119">object[]</TD>
970 <TD>
971 <P>Array of parameters.
972 </P>
973 </TD>
974 </TR>
975 </TABLE>
976 <H4>method-call-flags&nbsp;&amp; ArgumentsInMultiArray</H4>
977 <P>Used for calls to methods in which at least one parameter is not a primitive
978 type, and when other info needs to be serialized (i.e. context or signature).</P>
980 <TABLE id="Table7" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
981 <TR>
982 <TD width="119"><STRONG>Element</STRONG></TD>
983 <TD><STRONG>Description</STRONG></TD>
984 </TR>
985 <TR>
986 <TD width="119">Header[]</TD>
987 <TD>Only if there are Headers.</TD>
988 </TR>
989 <TR>
990 <TD width="119">object[]</TD>
991 <TD>
993 Array with the following values:</P>
994 <UL>
995 <LI>
996 Array of parameters.
997 <LI>
998 Method signature, only if method-call-flags has the flag IncludesSignature. It
999 is an array of Type.
1000 <LI>
1001 LogicalCallContext instance, only if method-call-flags has the flag
1002 IncludesLogicalCallContext.</LI></UL>
1004 If the array is empty, it is not serialized.</P>
1005 </TD>
1006 </TR>
1007 </TABLE>
1008 </P>
1009 </TD></TR></TBODY></TABLE> <a name="elem22"></a>
1010 <H3>22 Method Response</H3>
1011 <P>Represents a method response. The format of a method response can vary depending
1012 on the type of the return value and parameters.&nbsp;The following&nbsp;table
1013 shows the common format:</P>
1015 <TABLE id="Table9" style="WIDTH: 568px; HEIGHT: 140px" cellSpacing="1" cellPadding="1" width="568" border="1">
1016 <TR>
1017 <TD width="142"><STRONG>Element</STRONG></TD>
1018 <TD><STRONG>Description</STRONG></TD>
1019 </TR>
1020 <TR>
1021 <TD width="142" height="25">(byte) 22</TD>
1022 <TD height="25">Element code</TD>
1023 </TR>
1024 <TR>
1025 <TD width="142"><EM><A href="#method-response-flags">method-response-flags</A></EM></TD>
1026 <TD>Describes which information includes the method call</TD>
1027 </TR>
1028 <TR>
1029 <TD width="142"><EM><A href="#return-type-tag">return-type-tag</A></EM></TD>
1030 <TD>Describes which kind of value is returned</TD>
1031 </TR>
1032 <TR>
1033 <TD width="142">(bytes) 0, 0</TD>
1034 <TD>???</TD>
1035 </TR>
1036 </TABLE>
1037 <P></P>
1038 <P>The following tables describe the format of the message content depending on the
1039 value of method-response-flags:</P>
1040 <H4>method-response-flags &amp; NoArguments</H4>
1041 <P>Used when the method has no out arguments.</P>
1043 <TABLE id="Table10" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
1044 <TR>
1045 <TD width="139"><STRONG>Element</STRONG></TD>
1046 <TD><STRONG>Description</STRONG></TD>
1047 </TR>
1048 <TR>
1049 <TD width="139"><EM><EM><EM><A href="#type-spec">type-spec</A><BR>
1050 <EM><A href="#primitive-value">primitive-value</A></EM></EM></EM></EM></TD>
1051 <TD>
1052 <P><EM>Only if return-type-tag was PrimitiveType.<BR>
1053 </EM>Return value.</P>
1054 </TD>
1055 </TR>
1056 <TR>
1057 <TD width="139">Header[]</TD>
1058 <TD>Only if there are Headers.</TD>
1059 </TR>
1060 <TR>
1061 <TD width="139">object[]</TD>
1062 <TD>
1063 <P>Array with the following values:</P>
1064 <UL>
1065 <LI>
1066 Return value, only&nbsp;if <EM>return-type-tag</EM> was <EM>ObjectType</EM>
1067 <LI>
1068 LogicalCallContext instance, only&nbsp;if method-response-flags has the flag
1069 IncludeLogicalCallContext</LI></UL>
1070 <P>If the array is empty, it is not serialized.</P>
1071 </TD>
1072 </TR>
1073 </TABLE>
1074 </P>
1075 <H4>method-response-flags &amp; PrimitiveArguments</H4>
1076 <P>Used when all out arguments are primitive types.</P>
1077 <H2>
1078 <TABLE id="Table12" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
1079 <TR>
1080 <TD width="139"><STRONG>Element</STRONG></TD>
1081 <TD><STRONG>Description</STRONG></TD>
1082 </TR>
1083 <TR>
1084 <TD width="139"><EM><EM><EM><A href="#type-spec">type-spec</A><BR>
1085 <EM><A href="#primitive-value">primitive-value</A></EM></EM></EM></EM></TD>
1086 <TD>
1087 <P><EM>Only if return-type-tag was PrimitiveType.<BR>
1088 </EM>Return value.</P>
1089 </TD>
1090 </TR>
1091 <TR>
1092 <TD width="139">uint</TD>
1093 <TD>Number of out arguments</TD>
1094 </TR>
1095 <TR>
1096 <TD width="139"><EM><EM><EM>( <A href="#type-spec">type-spec</A>
1097 <BR>
1098 <EM><A href="#primitive-value">primitive-value</A> )</EM></EM></EM>&nbsp;*</EM></TD>
1099 <TD>One value for each argument</TD>
1100 </TR>
1101 <TR>
1102 <TD width="139">Header[]</TD>
1103 <TD>Only if there are Headers. Empty otherwise.</TD>
1104 </TR>
1105 <TR>
1106 <TD width="139">object[]</TD>
1107 <TD>
1108 <P>Array with the following values:</P>
1109 <UL>
1110 <LI>
1111 Return value, only&nbsp;if <EM>return-type-tag</EM> was <EM>ObjectType</EM>
1112 <LI>
1113 LogicalCallContext instance, only&nbsp;if method-response-flags has the flag
1114 IncludeLogicalCallContext</LI></UL>
1115 <P>If the array is empty, it is not serialized.</P>
1116 </TD>
1117 </TR>
1118 </TABLE>
1119 </H2>
1120 <H4>method-response-flags &amp; ArgumentsInSimpleArray</H4>
1121 <P>Used when at least one out argument is not a primitive type, return type is
1122 primitive, and no other info needs to be serialized.</P>
1123 <H2>
1124 <TABLE id="Table13" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
1125 <TR>
1126 <TD width="140"><STRONG>Element</STRONG></TD>
1127 <TD><STRONG>Description</STRONG></TD>
1128 </TR>
1129 <TR>
1130 <TD width="140"><EM><EM><EM><A href="#type-spec">type-spec</A><BR>
1131 <EM><A href="#primitive-value">primitive-value</A></EM></EM></EM></EM></TD>
1132 <TD>
1133 <P><EM>Only if return-type-tag was PrimitiveType.<BR>
1134 </EM>Return value.</P>
1135 </TD>
1136 </TR>
1137 <TR>
1138 <TD width="140">Header[]</TD>
1139 <TD>Only if there are Headers.</TD>
1140 </TR>
1141 <TR>
1142 <TD width="140">object[]</TD>
1143 <TD>Array that contains the out arguments</TD>
1144 </TR>
1145 </TABLE>
1146 </H2>
1147 <H4>method-response-flags &amp; ArgumentsInMultiArray</H4>
1148 <P>Used when at least one out argument is not a primitive type, return type is not
1149 primitive, and no other info needs to be serialized.</P>
1150 <H2>
1151 <TABLE id="Table14" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
1152 <TR>
1153 <TD width="141"><STRONG>Element</STRONG></TD>
1154 <TD><STRONG>Description</STRONG></TD>
1155 </TR>
1156 <TR>
1157 <TD width="141"><EM><EM><EM><A href="#type-spec">type-spec</A><BR>
1158 <EM><A href="#primitive-value">primitive-value</A></EM></EM></EM></EM></TD>
1159 <TD>
1160 <P>Only if <EM>return-type-tag </EM>was <EM>PrimitiveType.<BR>
1161 </EM>Return value.</P>
1162 </TD>
1163 </TR>
1164 <TR>
1165 <TD width="141">Header[]</TD>
1166 <TD>Only if there are Headers</TD>
1167 </TR>
1168 <TR>
1169 <TD width="141">object[]</TD>
1170 <TD>
1171 <P>Array with the following values:</P>
1172 <UL>
1173 <LI>
1174 Array of out arguments.
1175 <LI>
1176 Return value, only&nbsp;if <EM>return-type-tag</EM> was <EM>ObjectType</EM>
1177 <LI>
1178 LogicalCallContext instance, only&nbsp;if method-response-flags has the flag
1179 IncludeLogicalCallContext</LI></UL>
1180 </TD>
1181 </TR>
1182 </TABLE>
1183 </H2>
1184 <a name="other"></a>
1185 <H2>Other elements</H2>
1186 <a name="string"></a>
1187 <H3>string</H3>
1188 <P>A string value, serialized using BinaryWriter. It serializes the length of the
1189 string,&nbsp;using a&nbsp;7-bit encoded int, and then the string chars.</P>
1190 <a name="primitive-value"></a>
1191 <H3>primitive-value</H3>
1192 <P>A primitive value. It can be serialized using BinaryWriter and deserialized
1193 using BinaryReader. DateTime is serialized as a long (using the Ticks
1194 property).
1195 </P>
1196 <a name="value"></a>
1197 <H3>value</H3>
1198 <P>It can be a <A href="#primitive-value">primitive-value</A> or any of the
1199 following binary elements:</P>
1200 <UL>
1201 <LI>
1202 <A href="#elem1">1 - RefTypeObject</A>
1203 (only for value types)
1204 <LI>
1205 <A href="#elem4">4 - RuntimeObject</A>
1206 (only for value types)
1207 <LI>
1208 <A href="#elem5">5 - ExternalObject</A>&nbsp;(only for value types)
1209 <LI>
1210 <A href="#elem6">6 - String</A>
1211 <LI>
1212 <A href="#elem8">8 - BoxedPrimitiveTypeValue</A>
1213 <LI>
1214 <A href="#elem9">9 - ObjectReference</A>
1215 <LI>
1216 <A href="#elem10">10 - NullValue</A>
1217 <LI>
1218 <A href="#elem13">13 - ArrayFiller8b</A>&nbsp;(only inside
1219 single-dimensional object arrays)
1220 <LI>
1221 <A href="#elem14">14 - ArrayFiller32b</A> (only inside single-dimensional
1222 object arrays)</LI></UL>
1223 <a name="type-tag"></a>
1224 <H3>type-tag</H3>
1225 <P>Together with a <A href="#type-spec">type-spec</A> value, identifies a type.
1226 Some types can be represented using several type-tags. In this case, the most
1227 specific type-tag is allways used (it will&nbsp;take less bytes).</P>
1228 <P>type-tag can be one of the following:</P>
1230 <TABLE id="Table18" cellSpacing="1" cellPadding="1" width="600" border="1">
1231 <TR>
1232 <TD><STRONG>Value</STRONG></TD>
1233 <TD><STRONG>Label</STRONG></TD>
1234 <TD><STRONG>Description</STRONG></TD>
1235 <TD><STRONG>type-spec needed</STRONG></TD>
1236 </TR>
1237 <TR>
1238 <TD>0</TD>
1239 <TD>PrimitiveType</TD>
1240 <TD>A primitive type</TD>
1241 <TD>The code of the primitive type</TD>
1242 </TR>
1243 <TR>
1244 <TD>1</TD>
1245 <TD>String</TD>
1246 <TD>String class. type-spec is not needed.</TD>
1247 <TD>Not needed</TD>
1248 </TR>
1249 <TR>
1250 <TD>2</TD>
1251 <TD>ObjectType</TD>
1252 <TD>Object class. type-spec is not needed.</TD>
1253 <TD>Not needed</TD>
1254 </TR>
1255 <TR>
1256 <TD height="20">3</TD>
1257 <TD height="20">RuntimeType</TD>
1258 <TD height="20">A type from the .NET runtime (including arrays of .NET types)</TD>
1259 <TD height="20">The name of the class</TD>
1260 </TR>
1261 <TR>
1262 <TD>4</TD>
1263 <TD>GenericType</TD>
1264 <TD>Any other&nbsp;type (including arrays)</TD>
1265 <TD>The name of the class and the id of the assembly</TD>
1266 </TR>
1267 <TR>
1268 <TD>5</TD>
1269 <TD>ArrayOfObject</TD>
1270 <TD>Array of class Object</TD>
1271 <TD>Not needed</TD>
1272 </TR>
1273 <TR>
1274 <TD>6</TD>
1275 <TD>ArrayOfString</TD>
1276 <TD>Array of class String</TD>
1277 <TD>Not needed</TD>
1278 </TR>
1279 <TR>
1280 <TD>7</TD>
1281 <TD>ArrayOfPrimitiveType</TD>
1282 <TD>Array of primitive type</TD>
1283 <TD>The code of the primitive type</TD>
1284 </TR>
1285 </TABLE>
1286 </P>
1287 <a name="type-spec"></a>
1288 <H3>type-spec</H3>
1289 <P>It is the name or the code of a type. To decode it, a <A href="#type-tag">type-tag</A>
1290 value is needed. The following tables shows the format of type-spec for each
1291 type-tag value:</P>
1292 <H4>type-tag = PrimitiveType or ArrayOfPrimitiveType</H4>
1294 <TABLE id="Table16" style="WIDTH: 560px; HEIGHT: 14px" cellSpacing="1" cellPadding="1" width="560" border="1">
1295 <TR>
1296 <TD width="119"><STRONG>Element</STRONG></TD>
1297 <TD><STRONG>Description</STRONG></TD>
1298 </TR>
1299 <TR>
1300 <TD width="119"><A href="#primitive-type-code">primitive-type-code</A></TD>
1301 <TD>
1302 The code of the primitive type</TD>
1303 </TR>
1304 </TABLE>
1305 </P>
1306 <H4>type-tag = RuntimeType</H4>
1308 <TABLE id="Table15" style="WIDTH: 560px; HEIGHT: 14px" cellSpacing="1" cellPadding="1" width="560" border="1">
1309 <TR>
1310 <TD><STRONG><STRONG>Element</STRONG></STRONG></TD>
1311 <TD><STRONG><STRONG>Description</STRONG></STRONG></TD>
1312 </TR>
1313 <TR>
1314 <TD><EM><A href="#string">string</A></EM></TD>
1315 <TD>The name of the class, including the namespace</TD>
1316 </TR>
1317 </TABLE>
1318 <H4>type-tag = GenericType</H4>
1320 <TABLE id="Table17" style="WIDTH: 560px; HEIGHT: 14px" cellSpacing="1" cellPadding="1" width="560" border="1">
1321 <TR>
1322 <TD><STRONG>Element</STRONG></TD>
1323 <TD><STRONG><STRONG>Description</STRONG></STRONG></TD>
1324 </TR>
1325 <TR>
1326 <TD><EM><A href="#string">string</A></EM></TD>
1327 <TD>The name of the class, including the namespace</TD>
1328 </TR>
1329 <TR>
1330 <TD>uint</TD>
1331 <TD>Id of the assembly where the class is defined</TD>
1332 </TR>
1333 </TABLE>
1334 <H3>
1335 <H4>Other type-tag</H4>
1336 </H3>
1337 <P>For other type-tag values, no type-spec is needed.</P>
1338 <a name="method-call-flags"></a>
1339 <H3>method-call-flags</H3>
1341 <TABLE id="Table3" cellSpacing="1" cellPadding="1" width="600" border="1">
1342 <TR>
1343 <TD><STRONG>Value</STRONG></TD>
1344 <TD><STRONG>Label</STRONG></TD>
1345 <TD><STRONG>Description</STRONG></TD>
1346 </TR>
1347 <TR>
1348 <TD>1</TD>
1349 <TD>NoArguments</TD>
1350 <TD>No arguments included</TD>
1351 </TR>
1352 <TR>
1353 <TD>2</TD>
1354 <TD>PrimitiveArguments</TD>
1355 <TD>Primitive type arguments</TD>
1356 </TR>
1357 <TR>
1358 <TD>4</TD>
1359 <TD>ArgumentsInSimpleArray</TD>
1360 <TD>At least one out argument is not from a primitive type</TD>
1361 </TR>
1362 <TR>
1363 <TD height="20">8</TD>
1364 <TD height="20">ArgumentsInMultiArray</TD>
1365 <TD height="20">At least one out argument is not from a primitive type and other
1366 info is included in the message (context or signature)</TD>
1367 </TR>
1368 <TR>
1369 <TD>16</TD>
1370 <TD>ExcludeLogicalCallContext</TD>
1371 <TD>LogicalContext not included</TD>
1372 </TR>
1373 <TR>
1374 <TD>32</TD>
1375 <TD></TD>
1376 <TD>???</TD>
1377 </TR>
1378 <TR>
1379 <TD>64</TD>
1380 <TD>IncludesLogicalCallContext</TD>
1381 <TD>LogicalContext included</TD>
1382 </TR>
1383 <TR>
1384 <TD>128</TD>
1385 <TD>IncludesSignature</TD>
1386 <TD>Signature is included in the message. It is only included when calling an
1387 overloaded method.</TD>
1388 </TR>
1389 </TABLE>
1390 </P>
1391 <a name="method-response-flags"></a>
1392 <H3>method-response-flags</H3>
1394 <TABLE id="Table4" cellSpacing="1" cellPadding="1" width="600" border="1">
1395 <TR>
1396 <TD><STRONG>Value</STRONG></TD>
1397 <TD width="190"><STRONG>Label</STRONG></TD>
1398 <TD><STRONG>Description</STRONG></TD>
1399 </TR>
1400 <TR>
1401 <TD>1</TD>
1402 <TD width="190">NoArguments</TD>
1403 <TD>Response with no out arguments</TD>
1404 </TR>
1405 <TR>
1406 <TD>2</TD>
1407 <TD width="190">PrimitiveArguments</TD>
1408 <TD>
1409 Response with primitive type out arguments</TD>
1410 </TR>
1411 <TR>
1412 <TD>4</TD>
1413 <TD width="190">ArgumentsInSimpleArray</TD>
1414 <TD>Response with primitive type return value, and with at least one out argument
1415 that is not a primitive type.</TD>
1416 </TR>
1417 <TR>
1418 <TD>8</TD>
1419 <TD width="190">ArgumentsInMultiArray</TD>
1420 <TD>Response with at least one out argument that is not a primitive type, and other
1421 info is included in the message (context or signature)</TD>
1422 </TR>
1423 <TR>
1424 <TD>16</TD>
1425 <TD width="190">ExcludeLogicalCallContext</TD>
1426 <TD>LogicalContext not included</TD>
1427 </TR>
1428 <TR>
1429 <TD>32</TD>
1430 <TD width="190"></TD>
1431 <TD>???</TD>
1432 </TR>
1433 <TR>
1434 <TD>64</TD>
1435 <TD width="190">IncludesLogicalCallContext</TD>
1436 <TD>LogicalContext included</TD>
1437 </TR>
1438 </TABLE>
1439 </P>
1440 <a name="return-type-tag"></a>
1441 <H3>return-type-tag</H3>
1443 <TABLE id="Table11" cellSpacing="1" cellPadding="1" width="600" border="1">
1444 <TR>
1445 <TD><STRONG>Value</STRONG></TD>
1446 <TD><STRONG>Label</STRONG></TD>
1447 <TD><STRONG>Description</STRONG></TD>
1448 </TR>
1449 <TR>
1450 <TD>2</TD>
1451 <TD>Null</TD>
1452 <TD>Null return value</TD>
1453 </TR>
1454 <TR>
1455 <TD>8</TD>
1456 <TD>PrimitiveType</TD>
1457 <TD>Primitive type return value</TD>
1458 </TR>
1459 <TR>
1460 <TD>16</TD>
1461 <TD>ObjectType</TD>
1462 <TD>Object instance return value</TD>
1463 </TR>
1464 <TR>
1465 <TD>32</TD>
1466 <TD>Exception</TD>
1467 <TD>Method response is an exception</TD>
1468 </TR>
1469 </TABLE>
1470 </P>
1471 <a name="primitive-type-code"></a>
1472 <H3>primitive-type-code</H3>
1474 <TABLE id="Table19" height="171" cellSpacing="1" cellPadding="1" width="320" border="1">
1475 <TR>
1476 <TD width="45"><STRONG>Value</STRONG></TD>
1477 <TD width="190"><STRONG>Label</STRONG></TD>
1478 </TR>
1479 <TR>
1480 <TD width="45">1</TD>
1481 <TD width="190">Boolean
1482 </TD>
1483 </TR>
1484 <TR>
1485 <TD width="45">2</TD>
1486 <TD width="190">Byte</TD>
1487 </TR>
1488 <TR>
1489 <TD width="45">3</TD>
1490 <TD width="190">Char</TD>
1491 </TR>
1492 <TR>
1493 <TD width="45">5</TD>
1494 <TD width="190">Decimal</TD>
1495 </TR>
1496 <TR>
1497 <TD width="45">6</TD>
1498 <TD width="190">Double</TD>
1499 </TR>
1500 <TR>
1501 <TD width="45">7</TD>
1502 <TD width="190">Int16</TD>
1503 </TR>
1504 <TR>
1505 <TD width="45">8</TD>
1506 <TD width="190">Int32</TD>
1507 </TR>
1508 <TR>
1509 <TD width="45">9</TD>
1510 <TD width="190">Int64</TD>
1511 </TR>
1512 <TR>
1513 <TD width="45">10</TD>
1514 <TD width="190">SByte</TD>
1515 </TR>
1516 <TR>
1517 <TD width="45">11</TD>
1518 <TD width="190">Single</TD>
1519 </TR>
1520 <TR>
1521 <TD width="45">13</TD>
1522 <TD width="190">DateTime</TD>
1523 </TR>
1524 <TR>
1525 <TD width="45">14</TD>
1526 <TD width="190">UInt16</TD>
1527 </TR>
1528 <TR>
1529 <TD width="45">15</TD>
1530 <TD width="190">UInt32</TD>
1531 </TR>
1532 <TR>
1533 <TD width="45">16</TD>
1534 <TD width="190">UInt64</TD>
1535 </TR>
1536 <TR>
1537 <TD width="45">18</TD>
1538 <TD width="190">String</TD>
1539 </TR>
1540 </TABLE>
1541 </P>
1542 <HR width="100%" SIZE="1">
1543 <FONT size="1">2003 (C) Lluis Sanchez Gual&nbsp; (</FONT> <A href="mailto:lluis@ideary.com">
1544 <FONT size="1">lluis@ideary.com</FONT></A><FONT size="1">)</FONT>
1545 <P>&nbsp;</P>
1546 </body>
1547 </html>