JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Remote Administration Daemon Developer Guide     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information

Preface

1.  Introduction

2.  Concepts

Interface

Name

Derived Types

Features

Methods

Attributes

Events

Versioning

Numbering

Commitment

Clients and Versioning

rad Namespace

Naming

Equality

Patterns

Operations

Data Typing

Base Types

Derived Types

Optional Data

3.  Abstract Data Representation

4.  libadr

5.  Client Libraries

6.  Module Development

7.  rad Best Practices

A.  rad Binary Protocol

Data Typing

All data returned submitted to or obtained from rad APIs adheres to a strong typing system similar to that defined by XDR. For more information about XDR, see the XDR standard. This makes it simpler to define interfaces that have precise semantics, and makes server extensions (which are written in C) easier to develop. Of course, the rigidity of the typing exposed to an API's consumer is primarily a function of the client language and implementation.

Base Types

rad supports the following base types:

boolean
A boolean value (true or false).
integer
A 32-bit signed integer value.
uinteger
A 32-bit unsigned integer value.
long
A 64-bit signed integer value.
ulong
A 64-bit unsigned integer value.
float
A 32-bit floating-point value.
double
A 64-bit floating-point value.
string
A UTF-8 string.
opaque
Raw binary data.
secret
An 8-bit clean “character” array. The encoding is defined by the interface using the type. Client/server implementations may take additional steps, for example, zeroing buffers after use, to protect the contents of secret data.
time
An absolute UTC time value.
name
The name of an object in the rad namespace.

Derived Types

In addition to the base types, rad supports several derived types.

An enumeration is a set of user-defined tokens. Like C enumerations, rad enumerations may have specific integer values associated with them. Unlike C enumerations, rad enumerations and integers are not interchangeable. Among other things, this aspect means that an enumeration data value may not take on values outside those defined by the enumeration, which precludes the common but questionable practice of using enumerated types for bitfield values.

rad enumerations support designating an optional “fallback” value. A fallback value enables an enumeration to change without breaking compatibility between consumers and implementors of an API using different versions of the enumeration. When supported by the programming environment in use, the connection between the consumer and the implementor will automatically map unrecognized enumeration data values to the fallback value.


Caution

Caution - Fallback values are indispensible in cases where the set of possible enumeration must change over time. However, any change to an enumeration with a fallback value is considered to be a compatible change, forfeiting some of the benefits offered by rad's versioning scheme. Excessive use of fallback values will unnecessarily complicate the use and maintenance of a rad API.


A discriminated union is a data type that can be used to store polymorphic data, with typesafe access to the data. Like XDR, discriminated union's are composed of a set of “arms” and a “discriminant” that selects an “arm.” The discriminant may be a boolean or an enumeration type. A default arm may be specified for unions with an enumerated discriminator. When no arm is defined for a specific discriminant value and no default arm is defined, the arm for that value is void.

An array is an ordered list of data items of a fixed type. Arrays do not have a predefined size.

A structure is a record consisting of a fixed set of typed, uniquely named fields. A field's type may be a base type or derived type, or even another structure type.

Derived types offer almost unlimited flexibility. However, one important constraint imposed on derived types is that recursive type references are prohibited. Thus, complex self-referencing data types, for example, linked lists or trees, must be communicated after being mapped into simpler forms.

Optional Data

In some situations, data may be declared as nullable. Nullable data can take on a “non-value”, for example, NULL in C, or null in Java. Inversely, non-nullable data cannot be NULL. Only data of type opaque, string, secret, array, union or structure may be declared nullable. Additionally, only structure fields and certain API types can be nullable. Specifically, array data cannot be nullable because the array type is actually more like a list than an array.