Содержащиеся вНайти другие документыРесурсы поддержки | Загрузить это руководство в формате PDF (1494 КБ)
Chapter 7 Data Structure ReferenceNSAPI uses many data structures that are defined in the nsapi.h header file, which is in the install-dir/include directory. This chapter describes public data structures in nsapi.h. Note – The data structures in nsapi.h that are not described in this chapter are considered private and could change incompatibly in future releases. Some of the data structures described in this chapter might contain additional, undocumented fields. These fields are also considered private and might change incompatibly in future releases. Additional fields may be added in future release, so do not make assumptions regarding the size of data structures. This chapter has the following sections: Public Data StructuresThis section describes public data structures in nsapi.h. Session Data StructureA session is the time between the opening and closing of the connection between the client and the server. The following list describes the most important fields in this data structure:
The Session data structure holds variables that apply to a client, regardless of the requests being sent.
The following list describes the most important fields in the Session data structure:
Note – The Session NSAPI data structure cannot be used concurrently by multiple threads. Do not retain any reference to a Session or its contents after processing of the current request is complete. pblock Data StructureThe 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, pblockprovides the basic mechanism for packaging up parameters and values. Many functions exist for creating and managing parameter blocks, and for extracting, adding, and deleting entries. See the functions whose names start with pblock_ in Chapter 6, NSAPI Function and Macro Reference. You do not need to write code that accesses pblock data fields directly.
Note – The pblock NSAPI data structure can not be used concurrently by multiple threads. Do not retain any reference to a pblock or its contents after processing of the current request is complete. pb_entry Data StructureThe pb_entry is a single element in the parameter block.
pb_param Data StructureThe pb_param represents a name-value pair, as stored in a pb_entry.
Request Data StructureThe Request data structure describes an HTTP transaction, for example, the variables include the client's HTTP request headers. typedef struct{
*/Server working variables */
pblock *vars;
/* The method, URI, and protocol revision of this request */
pblock *reqpb;
/* Protocol specific headers */
int loadhdrs;
pblock *headers;
/* Server's response headers */
int senthdrs;
pblock *srvhdrs;
/* The object set constructed to fulfill this request */
httpd_objset *os;
} Request;
The following list describes the most important fields in the Request data structure:
Note – The Request NSAPI data structure cannot be used concurrently by multiple threads. Do not retain any references to a Request or its contents after processing of the current request. stat Data StructureWhen 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 the implementation of your platform, 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. shmem_s Data Structure
cinfo Data StructureThe cinfo data structure records the content information for a file.
sendfiledata Data StructureThe sendfiledata data structure is used to pass parameters to the net_sendfile function. The parameters are also passed to the sendfile method in an installed filter in response to a net_sendfile call.
Filter Data StructureThe Filter data structure is an opaque representation of a filter. A Filter structure is created by calling filter_create() Function.
FilterContext Data StructureThe FilterContext data structure stores the context associated with a particular filter layer. Filter layers are created by calling filter_insert() Function. Filter developers may use the data member to store filter-specific context information.
FilterLayer Data StructureThe FilterLayer data structure represents one layer in a filter stack. The FilterLayer structure identifies the filter installed at that layer. This structure provides pointers to layer-specific context and a filter stack that represents the layer immediately below it in the filter stack.
FilterMethods Data StructureThe FilterMethods data structure is passed to filter_createto define the filter methods that a filter supports. Each new FilterMethods instance must be initialized with the FILTER_METHODS_INITIALIZER macro. For each filter method that a filter supports, the corresponding FilterMethods member should point to a function that implements that filter method.
|
||||||||||||