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

3.  Abstract Data Representation

4.  libadr

5.  Client Libraries

6.  Module Development

7.  rad Best Practices

A.  rad Binary Protocol

Overview

Common Data Formats

Operations

Errors

Time

Object Names

ADR Data

ADR types

Interface Definitions

Connection Initialization

Messages

Operations

INVOKE Operation

GETATTR Operation

SETATTR Operation

LOOKUP Operation

DEFINE Operation

LIST Operation

SUB and UNSUB Operations

Common Data Formats

The types and concepts that appear repeatedly throughout the rad protocol are described in this section.

Operations

The various operations one can perform against the server are communicated with an operation code.

Table A-1 OP-CODE Description

Field Name
Length
Type
Description
op_code
4
int
operation code:
0
    OC-INVOKE
1
    OC-GETATTR
2
    OC-SETATTR
3
    OC-LOOKUP
4
    OC-DEFINE
5
    OC-LIST
6
    OC-SUB
7
    OC-UNSUB

Errors

Errors in the rad protocol are communicated by an error code, and optionally structured error data.

Table A-2 ERROR-CODE Description

Field Name
Length
Type
Description
error_code
4
int
error code:
0
    EC-OK
1
    EC-OBJECT
2
    EC-NOMEM
3
    EC-NOTFOUND
4
    EC-PRIV
5
    EC-SYSTEM
6
    EC-EXISTS
7
    EC-MISMATCH
8
    EC-ILLEGAL

For object-specific errors, EC-OBJECT, the format of the structured data is defined by the object's interface definition. For the remainder, save for EC-OK (which indicates success), the format is defined during the initial connection handshake. See Connection Initialization.

Time

Times are represented in the rad protocol, as seconds and nanoseconds offset from the epoch (January 1, 1970 UTC).

Note that the accuracy of such time data is determined by its context. In nearly all cases, the full nanosecond precision is only relevant when compared to time data obtained from the same host.

Table A-3 TIME-DATA

Field Name
Length
Type
Description
secs
8
hyper
Number of seconds
nsecs
4
int
Number of nanoseconds (0 ≤ nsec ≤ 109)

Object Names

rad object names are structured, consisting of a domain and one or more key-value pairs. When an object name or pattern needs to be represented in the rad protocol, this structure is flattened to a canonical string format. This string format consists of the domain, followed by a colon (':'), followed by comma-separated key-value pairs. Each key-value pair consists of the name, followed by an equals sign ('='), followed by the value.

Because keys and values may contain the special characters '=' or ',', a quoting algorithm is applied when constructing the string. The substitutions listed in the following table are applied to keys and values.

Table A-4 Object Name Escaping

Plain Text
Escaped Text
\
\S
,
\C
=
\E

Backslashes are found only as part of quoted characters, and commas and equals signs, when present, always have their special meaning. Object names that use no special characters are passed through unchanged. These facts can be used to simplify parsing or preprocessing of string-formatted object names.

Table A-5 NAME-DATA

Field Name
Length
Type
Description
name
variable
string<>
Flattened object name

For example, an object name in the domain com.example with the following keys and values:

Key
Value
directory
C:\
first,last
Doe,John

would be represented by the string com.example:directory=C:\S,first\Clast=Doe\CJohn.

ADR Data

Central to the rad protocol is the communication of data defined by ADR. Most ADR primitives map directly to XDR types:

Table A-6 Primitive ADR to Wire Type Mapping

ADR Type
Wire Type
boolean
XDR boolean
integer
XDR int
uinteger
XDR unsigned int
long
XDR hyper
ulong
XDR unsigned hyper
float
XDR float
double
XDR double
string
XDR string<>
opaque
XDR opaque<>
secret
XDR string<>
time
TIME-DATA (see Time)
name
NAME-DATA (see Object Names)

Optional ADR data of any type is represented as XDR optional data.

Table A-7 OPTIONAL-DATA Description

Field Name
Length
Type
Description
data
Varies
ADR-DATA*
Optional encoded data

Array data is communicated as an XDR array of the element data represented by an XDR unsigned int whose value is the number of array elements followed by that number of element data.

Table A-8 ARRAY-DATA Description

Field Name
Length
Type
Description
elements
Varies
ADR-DATA<>
Array elements

Structure data is communicated by communicating each structure field in the order they are defined. This may consist of a mixture of nullable and non-nullable data.

Table A-9 STRUCT-DATA

Field Name
Length
Type
Description
fields
Varies
ADR-DATA[n]
Fixed-length array of structure fields (n = type-defined field count)

Enumeration data is communicated as an XDR unsigned int whose value is the 1-based index into the list of enumerated values, that is, 1 would be the first enumerated value, n would be the nth enumerated value. A value of 0 represents the fallback value. For enumerations without a fallback value, the 0 value is unused.

Table A-10 ENUM-DATA Description

Field Name
Length
Type
Description
value
4
unsigned int
0 if fallback, 1-based index otherwise

Union data is communicated as an XDR unsigned int whose value is the 1-based index into the list of union arms. A value of 0 represents the default arm. When a non-default arm is selected, the arm is followed by that arm's data. When the default arm is selected, it is first followed by the discriminant data value and then is followed by the default arm's data.

Table A-11 UNION-DATA (Non-Default) Description

Field Name
Length
Type
Description
arm_index
4
unsigned int
1-based index into list of arms
arm_data
Varies
ADR-DATA
Arm data

Table A-12 UNION-DATA (Default) Description

Field Name
Length
Type
Description
arm_index
4
unsigned int
0
discriminant
4
ENUM-DATA | boolean
Discriminant value
arm_data
Varies
ADR-DATA
Arm data

ADR types

As discussed in ADR Data, the ADR data communicated by the rad protocol has a structure determined by its type. Before that data can be communicated to the client, however, the types themselves must be communicated.

For efficiency, type data is communicated using a system of type spaces and type references. A type space is an array of type definitions that is referenced by a protocol-defined set of consumers. A consumer referring to a type will use a type reference, which points to either a primitive type or to an element of the type space.

Both type references and type spaces refer to the various types by using an integral type code.

Table A-13 TYPE-CODE

Field Name
Length
Type
Description
type_code
4
int
Type code:
0
    TC-VOID
1
    TC-BOOLEAN
2
    TC-INTEGER
3
    TC-UINTEGER
4
    TC-LONG
5
    TC-ULONG
6
    TC-FLOAT
7
    TC-DOUBLE
8
    TC-TIME
9
    TC-STRING
10
    TC-OPAQUE
11
    TC-SECRET
12
    TC-NAME
13
    TC-ENUM
14
    TC-ARRAY
15
    TC-STRUCT
16
    TC-UNION

A type reference consists of an XDR int whose value is one of the type constants listed in the table. If the type is an enum, array, union, or struct, the type reference also includes an XDR int whose value is an index into the current type space as listed in the following tables.

Table A-14 TYPEREF (Basic Type)

Field Name
Length
Type
Description
type_code
4
TYPE-CODE
A primitive type code

Table A-15 TYPEREF (Derived Type)

Field Name
Length
Type
Description
type_code
4
TYPE-CODE
TC-ENUM, TC-ARRAY, TC-STRUCT, or TC-UNION
type_index
4
int
Type space index

A type space is a topologically sorted array of type definitions. A derived type may reference only derived types defined earlier in the type space. That is, a type reference used by the type at index X may reference only a primitive type or a derived type at index less than X. Recursively defined types are not supported.

Apart from a common distinguishing type code, each derived type is defined differently. Arrays are the simplest. An array definition consists of only a reference to the element type.

Table A-16 ARRAY-TYPE

Field Name
Length
Type
Description
type_code
4
TYPE-CODE
TC-ARRAY
element_type
Varies
TYPEREF
The element type

A structure type definition consists of a name and an array of field definitions. The order in which the fields are specified in STRUCT-TYPE is the order used to serialize the fields in STRUCT-DATA.

Table A-17 FIELD-TYPE

Field Name
Length
Type
Description
name
Varies
string<>
The field name
nullable
4
boolean
Is the field value nullable?
type
Varies
TYPEREF
The field type

Table A-18 STRUCT-TYPE

Field Name
Length
Type
Description
type_code
4
TYPE-CODE
TC-STRUCT
name
Varies
string<>
The structure name
fields
Varies
FIELD-TYPE<>
Ordered list of structure fields

A union type definition consists of a name, a reference to the discriminant type, optionally a default arm specification, and an array of arm definitions. The arm index referenced by UNION-DATA is an index into the array of arms defined by the corresponding UNION-TYPE.

Table A-19 ARM-TYPE

Field Name
Length
Type
Description
value
4
ENUM-DATA | boolean
The discriminant value that selects this arm
nullable
4
boolean
Is the arm's value nullable?
type
Varies
TYPEREF
The arm's type

Table A-20 UNION-TYPE (Without Default Arm)

Field Name
Length
Type
Description
type_code
4
TYPE-CODE
TC-UNION
name
Varies
string<>
The union name
disc_type
Varies
TYPEREF
The discriminant type
hasdefault
4
boolean
False
arms
Varies
ARM-TYPE<>
Ordered list of arms

Table A-21 UNION-TYPE (With Default Arm)

Field Name
Length
Type
Description
type_code
4
TYPE-CODE
TC-UNION
name
Varies
string<>
The union name
disc_type
Varies
TYPEREF
The discriminant type
hasdefault
4
boolean
True
def_nullable
4
boolean
Is the default arm value nullable?
def_type
Varies
TYPEREF
The default arm type
arms
Varies
ARM-TYPE<>
Ordered list of arms

Lastly, an enum type definition consists of a name, an optional fallback value, and a list of enumeration values. The value index referenced by ENUM-DATA is an index into the array of values defined by the corresponding ENUM-TYPE.

Table A-22 VALUE-TYPE

Field Name
Length
Type
Description
name
Varies
string<>
The value's name
value
4
int
The value's assigned value

Table A-23 ENUM-TYPE

Field Name
Length
Type
Description
type_code
4
TYPE-CODE
TC-ENUM
name
Varies
string<>
The enum name
fb_name
Varies
string<> *
The fallback value's name, if one exists
values
Varies
VALUE-TYPE<>
Ordered list of values

The type space itself is an array. Each element is one of these four type definitions (ARRAY-TYPE, STRUCT-TYPE, UNION-TYPE, or ENUM-TYPE).

Table A-24 TYPESPACE

Field Name
Length
Type
Description
types
Varies
?-TYPE<>
Ordered list of types in the type space

Interface Definitions

The ultimate description of the interactions permitted with a particular object is its interface definition. An interface definition contains many elements: an API name, a list of versioned interface names the interface supports, and definitions of the interface's attributes, methods, and events.

Each interface name has a set of stabilities and versions.

Table A-25 STABILITY-CODE

Field Name
Length
Type
Description
stability_code
4
int
Stability code:
1
    SC-PRIVATE
2
    SC-UNCOMMITTED
3
    SC-COMMITTED

Table A-26 VERSION-DATA

Field Name
Length
Type
Description
stability
4
STABILITY-CODE
Stability version applies to
major
4
int
Major version number
minor
4
int
Minor version number

Table A-27 INTERFACENAME-DATA

Field Name
Length
Type
Description
interface_name
Varies
string<>
Interface name
versions
Varies
VERSION-DATA<>
Interface versions by stability

An attribute consists of a name, stability, various flags, a type, and separate, optional read and write error types.

Table A-28 ATTRIBUTE-TYPE

Field Name
Length
Type
Description
aname
Varies
string<>
Attribute name
stability
4
STABILITY-CODE
Stability
readable
4
boolean
Is attribute readable?
writable
4
boolean
Is attribute writable?
nullable
4
boolean
Is attribute nullable?
type
Varies
TYPEREF
Attribute type
read_error
Varies
TYPEREF *
Error data on read, if applicable
write_error
Varies
TYPEREF *
Error data on write, if applicable

A method resembles an attribute. It has a name, stability, a result type, only a single optional error type, and an array of argument definitions.

Table A-29 ARGUMENT-TYPE

Field Name
Length
Type
Description
argname
Varies
string<>
Argument name
nullable
4
boolean
Is argument nullable?
type
Varies
TYPEREF
Argument type

Table A-30 METHOD-TYPE

Field Name
Length
Type
Description
mname
Varies
string<>
Method name
stability
4
STABILITY-CODE
Stability
nullable
4
boolean
Is result nullable?
result_type
Varies
TYPEREF
Result type
error
Varies
TYPEREF *
Error data, if applicable
args
Varies
ARGUMENT-TYPE<>
Arguments

An event consists only of a name, stability, and type.

Table A-31 EVENT-TYPE

Field Name
Length
Type
Description
ename
Varies
string<>
Method name
stability
4
STABILITY-CODE
Stability
event_type
Varies
TYPEREF
Event type

An interface definition combines all of the described elements.

Table A-32 INTERFACE-TYPE

Field Name
Length
Type
Description
api_name
Varies
string<>
API name (domain)
interfaces
Varies
INTERFACENAME-DATA<>
Interface names and versions implemented
types
Varies
TYPESET<>
Types used by interface definition
attributes
Varies
ATTRIBUTE-TYPE<>
Interface attributes
methods
Varies
METHOD-TYPE<>
Interface methods
events
Varies
EVENT-TYPE<>
Interface events