|
1 ******************************* |
|
2 * Ideas on Data Serialization * |
|
3 ******************************* |
|
4 |
|
5 1. Overview of XDR |
|
6 (1) What are the features of XDR |
|
7 a. Used in SunRPC |
|
8 b. Symmetric conversion |
|
9 c. No tags |
|
10 d. Primitive data types: |
|
11 integers, floating point numbers, enumerations and booleans |
|
12 e. Constructed data types: |
|
13 strings, arrays, opaque data, unions, pointers |
|
14 |
|
15 (2) How to use XDR for data serialization |
|
16 a. Don't have to use RPCGEN |
|
17 b. Use XDR library routines plus programmer-supplied conversion routines |
|
18 c. XDR streams: memory streams, I/O streams, record streams |
|
19 d. Example of memory streams: |
|
20 xdrmem_create (xdrs, buf, BUFSIZE, XDR_ENCODE); |
|
21 xdr_int (xdrs, &i); |
|
22 xdr_destroy (xdrs); |
|
23 e. Construct conversion routines for more complicated data types |
|
24 |
|
25 2. Overview of NDR |
|
26 (1) What are the features of NDR |
|
27 a. Used in DCE RPC |
|
28 b. Asymmetric conversion |
|
29 c. Architecture tag to specify: |
|
30 big endian or little endian for integer representation |
|
31 ASCII or EBCDIC for character representation |
|
32 IEEE or IBM or CRAY or VAX for floating-point representation |
|
33 d. Primitive data types: |
|
34 booleans, integers and enumerated types, floating-point numbers, uninterpreted octets |
|
35 e. Constructed data types: |
|
36 arrays, strings, structures, unions, pipes, pointers |
|
37 |
|
38 (2) How to use NDR for data serialization |
|
39 a. Use IDL encoding services stubs which are generated by IDL compiler |
|
40 with Interface Definition File and Attribute Configuration File |
|
41 b. Similar to XDR libray routines, but can't be provided by programmer |
|
42 |
|
43 3. Comparison of XDR and NDR |
|
44 (1) Symetric v. Asymetric conversion |
|
45 a. Asymetric conversion allows more flexibility |
|
46 b. Symmetric conversion doesn't require the architecture tag |
|
47 |
|
48 (2) NDR supports more data types |
|
49 a. Conformanent arrays, varying arrays, conformanent-varying arrays |
|
50 b. Array of strings, structures containing arrays |
|
51 c. Pipes |
|
52 |
|
53 (3) Availability |
|
54 a. XDR library is widely available |
|
55 b. DCE IDL compiler for NDR is not |