ONC+ Developer's Guide

NIS+ API

The NIS+ application programming interface (API) is a group of functions that can be called by an application to access and modify NIS+ objects. The NIS+ API has 54 functions that fall into nine categories:

The functions in each category are summarized in Table 5-2. The category names match the names by which they are grouped in the NIS+ manpages.

Table 5-2 NIS+ API Functions

Function 

Description 

nis_names()

Locate and Manipulate Objects  

nis_lookup()

Returns a copy of an NIS+ object. Can follow links. Though it cannot search for an entry object, if a link points to one, it can return an entry object.  

nis_add()

Adds an NIS+ object to the namespace. 

nis_remove()

Removes an NIS+ object in the namespace. 

nis_modify()

Modifies an NIS+ object in the namespace.  

nis_tables

Search and Update Tables.  

nis_list()

Searches a table in the NIS+ namespace and returns entry objects that match the search criteria. Can follow links and search paths from one table to another. 

nis_add_entry()

Adds an entry object to an NIS+ table. Can be instructed to either fail or overwrite if the entry object already exists. Can return a copy of the resulting object if the operation was successful. 

nis_freeresult()

Frees all memory associated with a nis_result structure.

nis_remove_entry()

Removes one or more entry objects from an NIS+ table. Can identify the object to be removed by using search criteria or by pointing to a cached copy of the object. If using search criteria, can remove all objects that match the search criteria; therefore, with the proper search criteria, can remove all entries in a table. Can return a copy of the resulting object if the operation was successful. 

nis_modify_entry()

Modifies one or more entry objects in an NIS+ table. Can identify the object to be modified by using search criteria or by pointing to a cached copy of the object.  

nis_first_entry()

Returns a copy of the first entry object in an NIS+ table.  

nis_next_entry()

Returns a copy of the "next" entry object in an NIS+ table. Because a table can be updated and entries removed or modified between calls to this function, the order of entries returned may not match the actual order of entries in the table.  

nis_local_names()

Get Default Names for the Current Process 

nis_local_directory()

Returns the name of the workstation's NIS+ domain. 

nis_local_host()

Returns the fully-qualified name of the workstation. A fully qualified name has the form <host-name>.<domain-name>. 

nis_local_group()

Returns the name of the current NIS+ group, which is specified by the environment variable NIS_GROUP. 

nis_local_principal()

Returns the name of the NIS+ principal whose UID is associated with the calling process. 

nis_getnames()

Returns a list of possible expansions to a particular name. 

nis_freenames()

Frees the memory containing the list generated by nis_getnames().

nis_groups()

Group Manipulation and Authorization 

nis_ismember()

Test whether a principal is a member of a group. 

nis_addmember()

Adds a member to a group. The member can be a principal, a group, or a domain. 

nis_removemember()

Deletes a member from a group. 

nis_creategroup()

Create a group object. 

nis_destroygroup()

Delete a group object. 

nis_verifygroup()

Tests whether a group object exists. 

nis_print_group_entry()

Lists the principals that are members of a group object. 

nis_server

Various services for NIS+ applications. 

nis_mkdir()

Creates the databases to support service for a named directory on a specified host.  

nis_rmdir()

Removes the directory from a host. 

nis_servstate()

Sets and reads state variables of NIS+ servers and flushes internal cashes.  

nis_stats()

Retrieves statistics about a server's performance.  

nis_getservlist()

Returns a list of servers that support a particular domain.  

nis_freeservlist()

Frees the list of servers returned by nis_getservlist().

nis_freetags()

Frees the memory associated with the results of nis_servstate() and nis_stats().

nis_db

Interface Between the NIS+ Server and the Database. Not To Be Used By a NIS+ Client. 

db_first_entry()

Returns a copy of the first entry of the specified table. 

db_next_entry()

Returns a copy of the entry succeeding the specified entry. 

db_reset_next_entry()

Terminates a first/next entry sequence. 

db_list_entries()

Returns copies of entries that meet specified attributes. 

db_remove_entry()

Removes all entries that meet specified attributes. 

db_add_entry()

Replaces an entry in a table identified by specified attributes with a copy of the specified object, or adds the object to the table. 

db_checkpoint()

Reorganizes the contents of a table to make access to the table more efficient. 

db_standby()

Advises the database manager to release resources. 

nis_error()

Functions that supply descriptive strings equivalent to NIS+ status values 

nis_sperrno()

Returns a pointer to the appropriate string constant. 

nis_perror()

Displays the appropriate string constant on standard output. 

nis_lerror()

Sends the appropriate string constant to syslog 

nis_sperror()

Returns a pointer to a statically allocated string to be used or to be copied with strdup().

nis_admin

Transaction logging functions used by servers 

nis_ping

Used by the master server of a directory to time stamp it. This forces replicas of the directory to be updated. 

nis_checkpoint()

Forces logged data to be stored in the table on disk. 

nis_subr

Functions To Help Operate on NIS+ Names and Objects. 

nis_leaf_of()

Returns the first label in an NIS+ name. The returned name does not have a trailing dot.  

nis_name_of()

Removes all domain-related labels and returns only the unique object portion of the name. The name passed to the function must be either in the local domain or in one of its child domains, or the function returns NULL. 

nis_domain_of()

Returns the name of the domain in which an object resides. The returned name ends in a dot.  

nis_dir_cmp()

Compares any two NIS+ names. The comparison ignores case and states whether the names are the same, descendants of each other, or not related. 

nis_clone_object()

Creates an exact duplicate of an NIS+ object.

nis_destroy_object()

Destroys an object created by nis_clone_object().

nis_print_object()

Prints the contents of an NIS+ object structure to stdout.