Previous     Contents     Index     DocHome     Next     
iPlanet Web proxy Server 3.6 Administrator's Guide - NT Version



Appendix B   Server Data Structures


The server plug-in API uses many data structures. All their definitions are gathered here for your convenience.



The Session Data Structure



A session is the time between the opening and the 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 in this code. It is defined in the base/session.h file.

typedef struct {
/* Information about the remote client */
   pblock *client;

   /* The socket descriptor to the remote client */
   SYS_NETFD csd;
   /* The input buffer for that socket descriptor */
   netbuf *inbuf;

/* Raw socket information about the remote */
/* client (for internal use) */
   struct in_addr iaddr;
} Session;



The Parameter Block (pblock) Data Structure



The parameter block is the hash table that holds pb_entry structures. Its contents are transparent to most code. It is defined in the base/pblock.h file.

#include "base/pblock.h"

typedef struct {
   int hsize;
   struct pb_entry **ht;
} pblock;


The Pb_entry Data Structure

The pb_entry data structure is a single element in the parameter block. It is defined in the base/pblock.h file.

struct pb_entry {
   pb_param *param;
   struct pb_entry *next;
};


The Pb_param Data Structure

The pb_param data structure represents a name-value pair, as stored in a pb_entry. It is defined in the base/pblock.h file.

typedef struct {
   char *name,*value;
} pb_param;



The Client Parameter Block



The Session->client parameter block structure, defined in the
base/session.h file, 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);


The Request Data Structure

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). It is declared in the frame/req.h file.

typedef struct {
   /* Server working variables */
   pblock *vars;

   /* The method, URI, and protocol revision of this request */
   block *reqpb;
   /* Protocol specific headers */
   int loadhdrs;
   pblock *headers;

   /* Server's response headers */
   pblock *srvhdrs;

   /* The object set constructed to fulfill this request */
   httpd_objset *os;

   /* The stat last returned by request_stat_path */
   char *statpath;
   struct stat *finfo;
} Request;


The Stat Data Structure

When the 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 must be obtained from your own implementation, but the basic outline of the structure is as follows:

struct stat {
   dev_t         st_dev;      /* device of inode */
   inot_t   st_ino;   /* inode number */
   short   st_mode;   /* mode bits */
   short   st_nlink;   /* number of links to file /*
   short   st_uid;   /* owner's user id */
   short   st_gid;   /* owner's group id */
   dev_t   st_rdev;   /* for special files */
   off_t   st_size;   /* file size in characters */
   time_t   st_atime;   /* time last accessed */
   time_t   st_mtime;   /* time last modified */
   time_t   st_ctime;   /* time inode last changed*/
}.

The elements that are most significant for server plug-in API activities are st_size, st_atime, st_mtime, and st_ctime.


The Shared Memory Structure, Shmem_s

typedef struct {
void *data; /* the data */
   HANDLE fdmap;
   int size; /* the maximum length of the data */
   char *name; /* internal use: filename to unlink if exposed */
   SYS_FILE fd; /* internal use: file descriptor for region */
} shmem_s;


The Netbuf Data Structure

The netbuf data structure is a platform-independent network-buffering structure that maintains such members as buffer address, position in buffer, current file size, maximum file size, and so on. Details of its structure vary between implementations. It is defined in buffer.h.


The Filebuffer Data Structure

The filebuffer data structure is a platform-independent file-buffering structure that maintains such members as buffer address, file position, current file size, and so on. Details of its structure vary between implementations. It is defined in buffer.h.


The Cinfo Data Structure

The cinfo data structure records the content information for a file. It is defined in cinfo.h.

typedef struct {
   char *type;         /* Identifies what kind of data is in the file*/
   char *encoding;         /* Identifies any compression or other content*/-
            /* independent transformation that's been applied*/
            /* to the file, such as uuencode)*/
   char *language;         /* Identifies the language a text document is in. */
} cinfo;


The SYS_NETFD Data Structure

The SYS_NETFD data structure is a platform-independent socket descriptor. Details of its structure vary between implementations.


The SYS_FILE Data Structure

The SYS_FILE data structure is a platform-independent file descriptor. Details of its structure vary between implementations.


The SEMAPHORE Data Structure

The SEMAPHORE data structure is a platform-independent implementation of semaphores. Details of its structure vary between implementations. It is defined in sem.h.


The Sockaddr_in Data Structure

The socaddr_in data structure is a platform-dependent socket address. For NT proxies, you can find more information in WINSOCK.H.


The CONDVAR Data Structure

The CONDVAR data structure is a platform-independent implementation of a condition variable. Details of its structure may vary between implementations. It is defined in crit.h.


The CRITICAL Data Structure

The CRITICAL data structure is a platform-independent implementation of a critical-section variable. Details of its structure may vary between implementations. It is defined in crit.h.


The SYS_THREAD Data Structure

The SYS_THREAD data structure is a platform-independent implementation of a system-thread variable. Details of its structure may vary between implementations. It is defined in systhr.h.


The CacheEntry Data Structure

The CacheEntry data structure is populated by various cache access functions, and contains information about the cache resources.

.
typedef struct _CacheEntry {

   unsigned

version;

/* cache metadata version */

   char*

url;

/* must be allocated by the caller; if null, url_size gives size */

   unsigned

url_size;

/* in: size of the allocated string; out: actual size if url is null */

   char*

filepath;

/* must be allocated by the caller; if null, filepath_size gives size */

   unsigned

filepath_size;

/* in: size of the allocated string; out: actual size if filepath is null */

   char*

content_type;

/* must be allocated by the caller; if null,content_type_size gives size */

   unsigned

content_type_siz e;

/* in: size of the allocated string; out:actual size if content_type is null */

   unsigned

content_offset;

/* offset of content in the file */

   unsigned long

content_length;

/* content length */

   time_t

last_modified;

/* last modified time (GMT, 0 if unspecified)*/

   time_t

expiration;

/* expiration time (GMT, 0 if unspecified) */

   unsigned long

transfer_duratio n_ms;

/* transfer duration in milliseconds */

   time_t

last_checked;

/* last validation time (GMT) */

   int

server_auth;

/* whether server authentication is needed */

   time_t

last_accessed;

/* last accessed time (GMT) */

   int

times_accessed;

/* number of times resource is served using current instance in cache */

} CacheEntry;


Previous     Contents     Index     DocHome     Next     
Copyright © 2001 Sun Microsystems, Inc. Some preexisting portions Copyright © 2001 Netscape Communications Corp. All rights reserved.

Last Updated March 28, 2001