Skip Navigation Links | |
Exit Print View | |
Remote Administration Daemon Developer Guide Oracle Solaris 11.1 Information Library |
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.
rad supports the following base 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 - 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.
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.