next up previous contents index
次へ: Remote Procedure Call Requests 上へ: Data Type Encoding 戻る: Primitive Data Types   目次   索引

Type Constructors

Closely following the type constructors of the C language, the SANE network protocol supports the following four constructors:

pointer:
A pointer is encoded by a word that indicates whether the pointer is a NULL-pointer which is then followed by the value that the pointer points to (in the case of a non-NULL pointer; in the case of a NULL pointer, no bytes are encoded for the pointer value).

array:
An array is encoded by a word that indicates the length of the array followed by the values of the elements in the array. The length may be zero in which case no bytes are encoded for the element values.

structure:
A structure is encoded by simply encoding the structure members in the order in which they appear in the corresponding C type declaration.

union:
A union must always be accompanied by a tag value that indicates which of the union members is the currently the active one. For this reason, the union itself is encoded simply by encoding the value of the currently active member.

Note that for type constructors, the pointer, element, or member values themselves may have a constructed type. Thus, the above rules should be applied recursively until a sequence of primitive types has been found.

Also SANE had no need for encoding of circular structures. This greatly simplifies the network protocol.


next up previous contents index
次へ: Remote Procedure Call Requests 上へ: Data Type Encoding 戻る: Primitive Data Types   目次   索引
MATSUBAYASHI 'Shaolin' Kohji 平成14年10月29日