![]() |
NSAPI Programmer's Guide |
Appendix A Data Structure Reference
NSAPI uses many data structures which are defined in the nsapi.h header file, which is in the directory server-root/plugins/include.
The NSAPI functions described in Chapter 5 "NSAPI Function Reference," provide access to most of the data structures and data fields. Before directly accessing a data structure in naspi.h, check if an accessor function exists for it.
For information about the privatization of some data structures in iPlanet Web Server 4.x, see "Privatization of Some Data Structures."
The rest of this chapter describes some of the frequently used public data structures in nsapi.h for your convenience. Note that only the most commonly used fields are documented here for each data structure; for complete details look in nsapi.h.
Privatization of Some Data Structures
In iPlanet Web Server 4.x, some data structures were moved from nsapi.h to nsapi_pvt.h. The data structures in nsapi_pvt.h are now considered to be private data structures, and you should not write code that accesses them directly. Instead, use accessor functions. We expect that very few people have written plugins that access these data structures directly, so this change should have very little impact on customer-defined plugins. Look in nsapi_pvt.h to see which data structures have been removed from the public domain and to see the accessor functions you can use to access them from now on.
Plugins written for Enterprise Server 3.x that access contents of data structures defined in nsapi_pvt.h will not be source compatible with In iPlanet Web Server 4.x and 6.x, that is, it will be necessary to #include "nsapi_pvt.h" in order to build such plugins from source. There is also a small chance that these programs will not be binary compatible with iPlanet Web Server 4.x and 6.x, because some of the data structures in nsapi_pvt.h have changed size. In particular, the directive structure is larger, which means that a plugin that indexes through the directives in a dtable will not work without being rebuilt (with nsapi_pvt.h included).
We hope that the majority of plugins do not reference the internals of data structures in nsapi_pvt.h, and therefore that most existing NSAPI plugins will be both binary and source compatible with iPlanet Web Server 6.0.
session
A session is the time between the opening and closing of the connection between the client and the server. The Session data structure holds variables that apply session wide, regardless of the requests being sent, as shown here:
pblock
The parameter block is the hash table that holds pb_entry structures. Its contents are transparent to most code. This data structure is frequently used in NSAPI; it provides the basic mechanism for packaging up parameters and values. There are many functions for creating and managing parameter blocks, and for extracting, adding, and deleting entries. See the functions whose names start with pblock_ in Chapter 5 "NSAPI Function Reference." You should not need to write code that access pblock data fields directly.
typedef struct {
int hsize;
struct pb_entry **ht;
} pblock;
pb_entry
The pb_entry is a single element in the parameter block.
struct pb_entry {
pb_param *param;
struct pb_entry *next;
};
pb_param
The pb_param represents a name-value pair, as stored in a pb_entry.
typedef struct {
char *name,*value;
} pb_param;
Session->client
The Session->client parameter block structure contains two entries:
The ip entry is the IP address of the client machine. The dns entry is the DNS name of the remote machine. This member must be accessed through the session_dns function call:
/*
* session_dns returns the DNS host name of the client for this
* session and inserts it into the client pblock. Returns NULL if
* unavailable.
*/
char *session_dns(Session *sn);
request
Under HTTP protocol, there is only one request per session. The Request structure contains the variables that apply to the request in that session (for example, the variables include the client's HTTP headers).
stat
When a program calls the stat( ) function for a given file, the system returns a structure that provides information about the file. The specific details of the structure should be obtained from your platform's implementation, but the basic outline of the structure is as follows:
The elements that are most significant for server plug-in API activities are st_size, st_atime, st_mtime, and st_ctime.
cinfo
The cinfo data structure records the content information for a file.
Previous Contents Index DocHome Next
Copyright © 2002 Sun Microsystems, Inc. All rights reserved.
Last Updated April 12, 2002