Go to main content

Remote Administration Daemon Developer's Guide

Exit Print View

Updated: April 2020

RAD Namespaces

Objects in the RAD namespace can be managed either as a set of statically installed objects or as a dynamic set of objects that are listed or created on demand.

RAD Static Objects

rad_modapi.h declares two interfaces for statically adding objects to a namespace.

rad_cont_insert() adds an object to the namespace. In turn, objects are created by calling rad_instance_create() with a pointer to the interface the object implements, a pointer to object-specific callback data and a pointer to a function to free the callback data. For example:

adr_name _t *uname = adr_name_vcreate("com.oracle.solaris.rad.user", 1, "type", "User");
rad_instance_t *inst = rad_instance_create(&interface_User_svr, kyle_data, NULL);
(void) rad_cont_insert(&rad_container, uname, inst);

rad_cont_insert_singleton() is a convenience routine that creates an object instance for the specified interface with the specified name and adds it to the namespace. The callback data is set to NULL.

adr_name _t *uname = adr_name_vcreate("com.oracle.solaris.rad.user", 1, "type", "User");
(void) rad_cont_insert_singleton(&rad_container, uname, &interface_User_svr);

RAD Module Dynamic Handlers

A module can register a dynamic handler for each interface that is implemented by the module. This allows efficient searching within a module by limiting a listing to a matching subset of the instances that the module is managing. Note that you can register a single dynamic handler for a module's entire namespace. Additionally, when you register a dynamic handler, you need to specify a lookup function pointer.

The following example shows the usage of dynamic handlers in the zones module.

cerr = rad_cont_register_dynamic(rad_container, aname,
             &modinfo, zone_listf, zone_lookupf, NULL);