OSF DCE Application
Development Guide
Core Components


Preface

Part 1. DCE Facilities

1. Introduction to DCE Facilities

2. DCE Host Services

2.1 Types of Applications

2.2 Issues of Distributed Applications

2.3 Managing a Host's Endpoint Map

2.4 Binding to dced Services

2.4.1 Host Service Naming in Applications

2.4.2 The dced Programs Maintains Entry Lists

2.4.3 Reading All of a Host Service's Data

2.4.4 Managing Individual dced Entries

2.5 Managing Hostdata on a Remote Host

2.5.1 Kinds of Hostdata Stored

2.5.2 Adding New Hostdata

2.5.3 Modifying Hostdata

2.5.4 Running Programs Automatically When Hostdata Changes

2.6 Controlling Servers Remotely

2.6.1 Two States of Server Management: Configuration and Execution

2.6.2 Configuring Servers

2.6.3 Starting and Stopping Servers

2.6.4 Enabling and Disabling Services of a Server

2.7 Validating the Security Server

2.8 Managing Server Key Tables

2.9 Sample dced Application

2.9.1 Running the Program

2.9.2 greet_dced.idl

2.9.3 greet_dced_server.c

2.9.4 greet_dced_manager.c

2.9.5 greet_dced_client.c

2.9.6 util.c

2.9.7 util.h

2.9.8 greet_dced.install

2.9.9 greet_dced.delete

2.9.10 Makefile

3. DCE Application Messaging

3.1 DCE and Messages

3.2 DCE Messaging Interface Usage

3.2.1 A Simple DCE Messaging Example

3.2.2 The DCE Message Interface and sams Input and Output Files

3.3 DCE Messaging Routines

3.3.1 Message Output Routines

3.3.2 Message Retrieval Routines

3.3.3 Message Table Routines

3.4.4 DCE XPG4 Routines

4. Using the DCE Serviceability Application Interface

4.1 How Programs Use Serviceability

4.2 Simple Serviceability Interface Tutorial

4.2.1 Defining the Message

4.2.2 Processing the sams File

4.2.3 Coding the Serviceability Calls

4.2.4 Building and Running the Program

4.2.5 Fields of a Serviceability Message

4.3 Serviceability Input and Output Files

4.4 Integrating Serviceability into a Server

4.4.1 Serviceability Strategy

4.4.2 Components and Subcomponents

4.4.3 Identifying Event Points

4.5 Application Use of Serviceability

4.5.1 Basic Server Calls

4.5.2 Extended Format Notation for Message Text

4.5.3 Specifying Message Severity

4.5.4 How to Route Messages

4.5.5 Table of Message Processing Specifiers

4.5.6 Logging and Log Reading

4.5.7 Message Action Attributes

4.5.8 Suppressing the Serviceability Message Prolog

4.5.9 Serviceability Use of the __FILE__ Macro

4.5.10 Forcing Use of the In-Memory Message Table

4.5.11 Dynamically Filtering Messages Before Output

4.5.12 Using Serviceability for Debug Messages

4.5.13 Performance Costs of Serviceability Debugging

4.5.14 Using the Remote Serviceability Interface

5. The DCE Backing Store

5.1 Data in a Backing Store

5.2 Using a Backing Store

5.3 Header for Data

5.4 The User Interface

5.5 The IDL Encoding Services

5.5.1 Encoding and Decoding in the Backing Store

5.5.2 Conformant Arrays Not Allowed

5.6 The Backing Store Routines

5.6.1 Opening a Backing Store

5.6.2 Closing a Backing Store

5.6.3 Storing or Retrieving Data

5.6.4 Freeing Data

5.6.5 Making or Retrieving Headers

5.6.6 Performing Iteration

5.6.7 Deleting Items from a Backing Store

5.6.8 Locking and Unlocking a Backing Store

5.7 Example of Backing Store Use

Part 2. DCE Threads

6. Introduction to Multithreaded Programming

6.1 Advantages of Using Threads

6.2 Software Models for Multithreaded Programming

6.2.1 Boss/Worker Model

6.2.2 Work Crew Model

6.2.3 Pipelining Model

6.2.4 Combinations of Models

6.3 Potential Disadvantages of Multithreaded Programming

7. Thread Concepts and Operations

7.1 Thread Operations

7.1.1 Starting a Thread

7.1.2 Terminating a Thread

7.1.3 Waiting for a Thread to Terminate

7.1.4 Deleting a Thread

7.2 New Primitives

7.3 Attributes Objects

7.3.1 Creating an Attributes Object

7.3.2 Deleting an Attributes Object

7.3.3 Thread Attributes

7.3.4 Mutex Attributes

7.3.5 Condition Variable Attributes

7.4 Synchronization Objects

7.4.1 Mutexes

7.4.2 Condition Variables

7.4.3 Other Synchronization Methods

7.5 One-Time Initialization Routines

7.6 Thread-Specific Data

7.7 Thread Cancellation

7.8 Thread Scheduling

8. Programming with Threads

8.1 Calling UNIX Services

8.1.1 Jacket Routines

8.1.2 Blocking System Calls

8.1.3 Calling fork( ) in a Multithreaded Environment

8.2 Using Signals

8.2.1Types of Signals

8.2.2 DCE Threads Signal Handling

8.2.3 Alternatives to Using Signals

8.3 Nonthreaded Libraries

8.3.1 Working with Nonthreaded Software

8.3.2 Making Nonthreaded Code Thread-Reentrant

8.4 Avoiding Nonreentrant Software

8.4.1 Global Lock

8.4.2 Thread-Specific Storage

8.5 Avoiding Priority Inversion

8.6 Using Synchronization Objects

8.6.1. Race Conditions

8.6.2 Deadlocks

8.7 Signaling a Condition Variable

9. Using the DCE Threads Exception-Returning Interface

9.1 Syntax for C

9.2 Invoking the Exception-Returning Interface

9.3 Operations on Exceptions

9.3.1. Declaring and Initializing an Exception Object

9.3.2 Raising an Exception

9.3.3 Defining a Region of Code over Which Exceptions Are Caught

9.3.4 Catching a Particular Exception or All Exceptions

9.3.5 Defining Epilogue Actions for a Block

9.3.6 Importing a System-Defined Error Status into the Program as an Exception

9.4 Rules and Conventions for Modular Use of Exceptions

9.5 DCE Threads Exceptions and Definitions

10. DCE Threads Example

10.1 Details of Program Logic and Implementation

10.2 DCE Threads Example Body

Part 3. DCE Remote Procedure Call

11. Developing a Simple RPC Application

11.1 The Remote Procedure Call Model

11.1.1 RPC Application Code

11.1.2 Stubs

11.1.3 The RPC Runtime

11.1.4 RPC Application Components That Work Together

11.1.5 Overview of DCE RPC Development Tasks

11.2 Writing an Interface Definition

11.2.1 RPC Interfaces That Represent Services

11.2.2 Generating an Interface UUID

11.2.3 Naming the Interface

11.2.4 Specifying Interface Attributes

11.2.5 Import Declarations

11.2.6 Constant Declarations

11.2.7 Type Declarations

11.2.8 Operation Declarations

11.3 Running the IDL Compiler

11.4 Writing the Client Code

11.5 Writing the Server Code

11.5.1 The greet_server.c Source Code

11.5.2 The greet_manager.c Source Code

11.6 Building the greet Programs

11.7 Running the greet Programs

12. RPC Fundamentals

12.1 Universal Unique Identifiers

12.2 Communications Protocols

12.3 Binding Information

12.3.1 Server Binding Information

12.3.2 Defining a Compatible Server

12.3.3 How Clients Obtain Server Binding Information

12.3.4 Client Binding Information for Servers

12.4 Endpoints

12.4.1 Well-Known Endpoints

12.4.2 Dynamic Endpoints

12.5 Execution Semantics

12.6 Communications Failures

12.7 Scaling Applications

12.8 RPC Objects

13. Basic RPC Routine Usage

13.1 Overview of the RPC Routines

13.1.1 Basic Operations of RPC Communications

13.1.2 Basic Operations of the NSI

13.1.3 Basic Operations of Authenticated RPCs

13.2 Server Initialization Using the RPC Routines

13.2.1 Assigning Types to Objects

13.2.2 Registering Interfaces

13.2.3 Selecting RPC Protocol Sequences

13.2.4 Obtaining a List of Server Binding Handles

13.2.5 Registering Endpoints

13.2.6 Making Binding Information Accessible to Clients

13.2.7 Listening for Calls

13.3 How clients find servers

13.3.1 Searching a Namespace

13.3.2 Using String Bindings to Obtain Binding Information

14. RPC and Other DCE Components

14.1 Threads of Execution in RPC Applications

14.1.1 Remote Procedure Call Threads

14.1.2 Cancels

14.1.3 Multithreaded RPC Applications

14.2 Security and RPC: Using Authenticated Remote Procedure Calls

14.2.1 Authentication

14.2.2 Authorization

14.2.3 Authenticated RPC Routines

14.2.4 Using RPC Within a Single Thread

14.3 Directory Services and RPC: Using the Namespace

14.3.1 NSI Directory Service Entries

14.3.2 Searching the Namespace for Binding Information

14.3.3 Strategies for Using Directory Service Entries

14.3.4 The Service Model for Defining Servers

14.3.5 The Resource Model for Defining Servers

15. Developing Applications that Use Distributed Objects

15.1 IDL and the Class Hierarchy of a DCE Application

15.1.1 Specifying a C++ Class via an IDL Interface

15.1.2 IDL-Generated Classes as Part of Your Hierarchy

15.2 Servers that Manage Distributed Objects

15.2.1 Initializing Object-Oriented Servers

15.2.2 Implementing Distributed-Dynamic Objects

15.2.3 Implementing Static Member Functions

15.2.4 When Function Parameters Are Remote Objects

15.2.5 Naming Objects

15.3 Clients That Use Distributed Objects

15.3.1 Creating Remote-Dynamic Objects

15.3.2 Creating Client-Local Objects

15.3.3 Location Transparency of Local and Remote Objects

15.3.4 Finding Known Remote Objects

15.4 Multiple Interfaces and Interface Inheritance

15.4.1 Implementing Multiple Managers

15.4.2 Using Objects that Support Multiple Interfaces

15.5 Passing C++ Objects as DCE RPC Parameters

15.5.1 Representation

15.5.2 Delegation

15.6 Integrating C and C++ Clients and Servers

15.6.1 Writing a C++ Client for C Servers

15.6.2 Writing a C Client for C++ Servers

16. Writing Internationalized RPC Applications

16.1 Character Sets, Code Sets, and Code Set Conversion

16.2 Remote Procedure Call with Character/Code Set Interoperability

16.3 Building An Application for Character and Code Set Interoperability

16.3.1 Writing the Interface Definition File

16.3.2 Writing the Attribute Configuration File

16.3.3 Writing the Stub Support Routines

16.3.4 Writing the Server Code

16.3.5 Writing the Client Code

16.3.6 Writing the Evaluation Routine

17. Topics in RPC Application Development

17.1 Memory Management

17.1.1 Using the Memory Management Defaults

17.1.2 Using rpc_ss_allocate and rpc_ss_free

17.1.3 Using Your Own Allocation and Free Routines

17.1.4 Using Thread Handles in Memory Management

17.2 Guidelines for Error Handling

17.2.1 Exceptions

17.2.2 The fault_status Attribute

17.2.3 The comm_status Attribute

17.2.4 Determining Which Method to Use for Handling Exceptions

17.2.5 Examples of Error Handling

17.3 Context Handles

17.3.1 Context Handles in the Interface

17.3.2 Context Handles in a Server Manager

17.3.3 Context Rundown

17.3.4 Binding and Security Information

17.4 Pipes

17.4.1 Input Pipes

17.4.2 Output Pipes

17.4.3 Pipe Summary

17.5 Nested Calls and Callbacks

17.6 Routing Remote Procedure Calls

17.6.1 Obtaining an Endpoint

17.6.2 Buffering Call Requests

17.6.3 Queuing Incoming Calls

17.6.4 Selecting a Manager

17.7 Creating Portable Data via the IDL Encoding Services

17.7.1 Memory Management

17.7.2 Buffering Styles

17.7.3 IDL Encoding Services Handles

17.7.4 Programming Example

17.7.5 Performing Multiple Operations on a Single Handle

17.7.6 Determining the Identity of an Encoding

18. Interface Definition Language

18.1 The Interface Definition Language File

18.2 Syntax Notation Conventions

18.2.1 Typography

18.2.2 Special Symbols

18.3 IDL Lexical Elements

18.3.1 Identifiers

18.3.2 Keywords

18.3.3 Punctuation Characters

18.3.4 White Space

18.3.5 Case Sensitivity

18.4 IDL Versus C

18.4.1 Declarations

18.4.2 Data Types

18.4.3 Attributes

18.5 Interface Definition Structure

18.5.1 Interface Definition Header

18.5.2 Interface Definition Body

18.6 Overview of IDL Attributes

18.7 Interface Definition Header Attributes

18.7.1 The uuid Attribute

18.7.2 The version Attribute

18.7.3 The endpoint Attribute

18.7.4 The exceptions Attribute

18.7.5 The pointer_default Attribute

18.7.6 The local Attribute

18.7.7 Rules for Using Interface Definition Header Attributes

18.7.8 Examples of Interface Definition Header Attributes

18.8 Import Declarations

18.9 Constant Declarations

18.9.1 Integer Constants

18.9.2 Boolean Constants

18.9.3 Character Constants

18.9.4 String Constants

18.9.5 NULL Constants

18.10 Type Declarations

18.10.1 Type Attributes

18.10.2 Base Type Specifiers

18.10.3 Constructed Type Specifiers

18.10.4 Predefined Type Specifiers

18.10.5 Type Declarator

18.11 Operation Declarations

18.11.1 Operation Attributes

18.11.2 Operation Attributes: Execution Semantics

18.11.3 Operation Attributes: Memory Management

18.12 Parameter Declarations

18.13 Basic Data Types

18.13.1 Integer Types

18.13.2 Floating-Point Types

18.13.3 The char Type

18.13.4 The boolean Type

18.13.5 The byte Type

18.13.6 The void Type

18.13.7 The handle_t Type

18.13.8 The error_status_t Type

18.13.9 International Characters

18.14 Constructed Data Types

18.14.1 Structures

18.14.2 Unions

18.14.3 Enumeration

18.14.4 Pipes

18.14.5 Arrays

18.14.6 Strings

18.14.7 Pointers

18.14.8 Customized Handles

18.14.9 Context Handles

18.15 IDL Support for C++

18.15.1 The idl-generated Class Hierarchy

18.15.2 The Interface Inheritance Operator

18.15.3 The static Keyword for Operations

18.15.4 The C++ Reference Operator (&) on Parameters

18.15.5 Functions Generated by IDL

18.16 Associating a Data Type with a Transmitted Type

18.17 IDL Grammar Synopsis

19. Attribute Configuration Language

19.1 Syntax Notation Conventions

19.2 Attribute Configuration File

19.2.1 Naming the ACF

19.2.2 Compiling the ACF

19.2.3 ACF Features

19.3 Structure

19.3.1 ACF Interface Header

19.3.2 ACF Interface Body

19.3.3 The include Statement and the C++ cstub and sstub

19.3.4 The auto_handle Attribute

19.3.5 The explicit_handle Attribute

19.3.6 The implicit_handle Attribute

19.3.7 The client_memory Attribute

19.3.8 The comm_status and fault_status Attributes

19.3.9 The code and nocode Attributes

19.3.10 The represent_as Attribute

19.3.11 The enable_allocate Attribute

19.3.12 The heap Attribute

19.3.13 The extern_exceptions Attribute

19.3.14 The encode and decode Attributes

19.3.15 The cs_char Attribute

19.3.16 The cs_stag, cs_drtag, and cs_rtag Attributes

19.3.17 The cs_tag_rtn Attribute

19.3.18 The binding_callout Attribute

19.3.19 The C++ Attributes cxx_new, cxx_static, cxx_lookup, and cxx_delegate

19.4 Summary of Attributes

19.5 Attribute Configuration Language

Part 4. DCE Distributed Time Service

20. Introduction to the Distributed Time Service API

20.1 DTS Time Representation

20.1.1 Absolute Time Representation

20.1.2 Relative Time Representation

20.2 Time Structures

20.2.1 The utc Structure

20.2.2 The tm Structure

20.2.3 The timespec Structure

20.2.4 The reltimespec Structure

20.3 DTS API Header Files

20.4 DTS API Routine Functions

21. Time-Provider Interface

21.1 General TPI Control Flow

21.1.1 ContactProvider Procedure

21.1.2 ServerRequestProviderTime Procedure

21.2 Time-Provider Process IDL File

21.3 Initializing the Time-Provider Process

21.4 Time-Provider Algorithm

21.5 DTS Synchronization Algorithm

21.6 Running the Time-Provider Process

21.7 Sources of Additional Information

22. DTS API Routines Programming Example

Part 5. DCE Security Service

23. Overview of Security

23.1 Purpose and Organization of the Security Topics

23.2 About Authenticated RPC

23.3 About the GSSAPI

23.4 UNIX System Security and DCE Security

23.5 What Authentication and Authorization Mean

23.6 Authentication, Authorization, and Data Protection in Brief

23.7 Summary of DCE Security Services and Facilities

23.7.1 Interfaces to the Security Server

23.7.2 Interfaces to the Login Facility

23.7.3 Interfaces to the Extended Registry Attribute Facility

23.7.4 Interfaces to the Extended Privilege Attribute Facility

23.7.5 Interfaces to the Key Management Facility

23.7.6 Interfaces to the ID Map Facility

23.7.7 Interfaces to the Access Control List Facility

23.7.8 DCE Implementations of UNIX System Program Interfaces

23.7.9 Interfaces to the Password Management Facility

23.8 Relationships Between the DCE Security Service and DCE Applications

23.9 DTS, the Cell Namespace, and Security

23.9.1 DTS and Security

23.9.2 The Cell Namespace and the Security Namespace

24. Authentication

24.1 Background Concepts

24.1.1 Principals

24.1.2 The Shared-Secret Authentication Protocol

24.1.3 Cells and Realms

24.1.4 Protection Levels

24.1.5 Data Encryption Mechanisms

24.2. A Walkthrough of Shared-Secret Authentication Protocols

24.2.1 Authenticating a User

24.2.2 Authenticating an Application

24.3 Intercell Authentication

24.3.1 KDS Surrogates

24.3.2 Intercell Authentication by Trust Peers

25. Authorization

25.1 DCE Authorization

25.1.1 Object Types and ACL Types

25.1.2 ACL Manager Types

25.1.3 Access Control Lists

25.1.4 ACL Entries

25.1.5 Access Checking

25.1.6 Examples of ACL Checking

25.2 Name-Based Authorization

26. GSSAPI Credentials

26.1 Using Default Credentials

26.1.1 Initiating a Security Context

26.1.2 Accepting a Security Context

26.2 Creating New Credential Handles

26.2.1 Initiating a Security Context with New Credential Handles

26.2.2 Accepting a Security Context Using New Credential Handles

26.3 Delegating Credentials

26.3.1 Initiating a Security Context to Delegate Credentials

26.3.2 Accepting a Security Context with Delegated Credentials

27. The Extended Privilege Attribute API

27.1 Identities of Principals in Delegation

27.1.1 ACL Entry Types for Delegation

27.1.2 ACL Checking for Delegation

27.2 Calls to Establish Delegation Chains

27.2.1 Types of Delegation

27.2.2 Target and Delegate Restrictions

27.2.3 Optional and Required Restrictions

27.2.4 Compatibility Between Version 1.1 and Pre-Version 1.1 Servers and Clients

27.3 Calls to Extract Privilege Attribute Information

27.4 Disabling Delegation

27.5 Setting Extended Attributes

28. The Registry API

28.1 Binding to a Registry Site

28.2 The Registry Database

28.2.1 Creating and Maintaining PGO Items

28.2.2 Creating and Maintaining Accounts

28.2.3 Registry Properties and Policies

28.2.4 Routines to Return UNIX Structures

28.2.5 Miscellaneous Registry Routines

29. The Extended Attribute API

29.1 The ERA API

29.1.1 Attribute Schema

29.1.2 Attribute Types and Instances

29.1.3 Attribute Type Components

29.2 Calls to Manipulate Schema Entries

29.2.1 The sec_attr_schema_entry_t Data Type

29.2.2 Creating and Managing Schema Entries

29.2.3 Reading Schema Entries

29.2.4 Reading the ACL Manager Types

29.3 Calls to Manipulate Attribute Instances

29.3.1 The sec_attr_t Data Type

29.3.2 Creating and Managing Attribute Instances

29.3.3 Reading Attribute Instances

29.4 The Attribute Trigger Facility

29.4.1 Defining an Attribute Trigger/Attribute Association

29.4.2 Trigger Binding

29.4.3 Access Control on Attributes with Triggers

29.5 Calls that Access Attribute Triggers

29.5.1 Using sec_attr_trig_cursor_t with sec_attr_trig_query( )

29.5.2 The sec_rgy_attr_trig_query( ) and sec_rgy_attr_trig_update( ) Calls

29.5.3 The priv_attr_triq_query( ) Call

29.6 The DCE Attribute API

29.7 Macros to Aid Extended Attribute Programming

29.7.1 Macros to Access Binding Fields

29.7.2 Macros to Access Schema Entry Fields

29.7.3 Macros to Access Attribute Instance Fields

29.7.4 Binding Data Structure Size Calculation Macros

29.7.5 Schema Entry Data Structure Size Calculation Macros

29.7.6 Attribute Instance Data Structure Size Calculation Macros

29.7.7 Binding Semantic Check Macros

29.7.8 Schema Entry Semantic Check Macros

29.7.9 Attribute Instance Semantic Check Macros

29.7.10 Schema Entry Flag Set and Unset Macros

29.7.11 Schema Trigger Entry Flag Check Macros

29.8 Utilities to Use with Extended Attribute Calls

30. The Login API

30.1 Establishing Login Contexts

30.1.1 Validating the Login Context and Certifying the Security Server

30.1.2 Validating the Login Context Without Certifying the Security Server

30.1.3 Example of a System Login Program

30.2 Context Inheritance

30.2.1 The Initial Context

30.2.2 Private Contexts

30.3 Handling Expired Certificates of Identity

30.4 Importing and Exporting Contexts

30.5 Changing a Groupset

30.6 Miscellaneous Login API Functions

30.6.1 Getting the Current Context

30.6.2 Getting Information from a Login Context

30.6.3 Getting Password and Group Information for Local Process Identities

30.6.4 Releasing and Purging a Context

31. The Key Management API

31.1 Retrieving a Key

31.2 Changing a Key

31.3 Automatic Key Management

31.4 Deleting Expired Keys

31.5 Deleting a Compromised Key

32. The Access Control List APIs

32.1 The Client-Side API

32.1.1 Binding to an ACL

32.1.2 ACL Editors and Browsers

32.1.3 Errors

32.2 Guidelines for Constructing ACL Managers

32.3 Extended Naming of Protected Objects

32.3.1 The ACL Network Interface

32.3.2 The ACL Library

33. The ID Map API

34. DCE Audit Service

34.1 Features of the DCE Audit Service

34.2 Components of the DCE Audit Service

34.3 DCE Audit Service Concepts

34.4 Administration and Programming in DCE Audit

34.4.1 Programmer Tasks

34.4.2 Administrator Tasks

35. Using the Audit API Functions

35.1 Adding Audit Capability to Distributed Applications

35.1.1 Opening the Audit Trail

35.1.2 Initializing the Audit Records

35.1.3 Adding Event-Specific Information

35.1.4 Committing an Audit Record

35.1.5 Closing an Audit Trail File

35.2 Writing Audit Trail Analysis and Examination Tools

35.2.1 Opening an Audit Trail File for Reading

35.2.2 Reading the Desired Audit Records into a Buffer

35.2.3 Transforming the Audit Record into Readable Text

35.2.4 Discarding the Audit Record

35.2.5 Closing the Audit Trail File

36. The Password Management API

36.1 The Client-Side API

36.2 The Password Management Network Interface

37. The DCE Certification Service

37.1 Who Needs to Use the Certification API?

37.2 Overview of DCE Certification

37.2.1 Use of Public Keys

37.2.2 Contents of Certificates

37.2.3 Component Parts of the DCE Certification API

37.2.4 High Level Certification API

37.2.5 Policy Models

37.3 Implementing and Registering a Cryptographic Module

37.3.1 Contents of a Cryptographic Module

37.3.2 Accessing a Registered Cryptographic Module

37.3.3 Signature Algorithms Provided by DCE Certification

37.3.4 Registering a Cryptographic Module

37.4 Implementing and Registering a Policy Module

37.5 The Low Level Certificate Manipulation API

37.5.1 Polcy Module Implementation

37.5.2 Accessing a Registered Policy Module

37.5.3 Registering a Policy Module

37.5.4 Registering the Module