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

API Definitions and Implementation

Entry Points and Generated Stubs

Global Variables

Module Registration

Instance Management

Container Interactions

Logging

Using Threads

Synchronization

Subprocesses

Utilities

Locales

Transactional Processing

Asynchronous Methods and Progress Reporting

rad Namespaces

Static Objects

rad Module Linkage

7.  rad Best Practices

A.  rad Binary Protocol

rad Module Linkage

Each module is required to provide a function, _rad_init(), for linkage and identification purposes. This function is called before any other function in the module. It is used to initialize the module and register itself with rad.


Note - Within _rad_init(), modules can test the rad_isproxy variable to determine whether this routine is running in the main rad (proxy) daemon.

When rad_isproxy is B_TRUE, modules that depend on running as the authenticated user in the rad slave should return immediately from _rad_init() without further initialization. Modules that do not perform any user-specific or restricted operations should proceed with initialization.

When rad_isproxy is B_FALSE, the module is being initialized in the slave.


Example 6-1 Module Initialization and Registration

#include <rad/rad_modapi.h>

static rad_modinfo_t modinfo = {"usermgr", "User Management Module"};

int
_rad_init(void *handle)
{
    if (rad_module_register(handle, RAD_MODVERSION, &modinfo) == -1)
        return (-1);

    /* This module must be run as the authenticated user */
    if (rad_isproxy)
        return (0);

    (void) cont_insert_singleton(rad_container, adr_name_fromstr(
        "com.oracle.solaris.user:type=UserManager"),
        &interface_UserMgr_svr);

    return (0);
}