summaryrefslogtreecommitdiff
path: root/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/object.h
blob: 45180c5b8849df2da192f2f05cba6009e61aa364 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
/*
 * $Id$
 *
 * Copyright (c) 1994, 1995.  Netscape Communications Corporation.  All
 * rights reserved.
 *
 * Use of this software is governed by the terms of the license agreement for
 * the Netscape Communications or Netscape Comemrce Server between the
 * parties.
 */


/* ------------------------------------------------------------------------ */


/*
 * object.h: Handle httpd objects
 *
 * Manages information about a document from config. files. Called mainly
 * by objset.c.
 *
 * This module does not assume anything about the directives being parsed.
 * That is handled by objset.c.
 *
 * This module requires the pblock module from the base library.
 *
 * Rob McCool
 *
 */


#ifndef OBJECT_H
#define OBJECT_H


#include "netsite.h"
#include "base/pblock.h"
#include "base/session.h"




/* ------------------------------ Constants ------------------------------- */


/* The maximum directive length unabbreviated, plus one space */
#define MAX_DNAME_LEN 11
#define NUM_DIRECTIVES 7


/* ------------------------------ Structures ------------------------------ */



/*
 * Hierarchy of httpd_object
 *
 * An object contains dtables.
 *
 * Each dtable is a table of directives that were entered of a certain type.
 * There is one dtable for each unique type of directive.
 *
 * Each dtable contains an array of directives, each of which is equivalent
 * to one directive that occurred in a config. file.
 *
 * It is up to the caller to determine how many dtables will be allocated
 * and to keep track of which of their directive types maps to which dtable
 * number.
 */


/*
 * directive is a structure containing the protection and parameters to an
 * instance of a directive within an httpd_object.
 *
 * param is the parameters, client is the protection.
 */

typedef struct {
    pblock *param;
    pblock *client;
} directive;

/*
 * dtable is a structure for creating tables of directives
 */

typedef struct {
    int ni;
    directive *inst;
} dtable;

/*
 * The httpd_object structure.
 *
 * The name pblock array contains the names for this object, such as its
 * virtual location, its physical location, or its identifier.
 *
 * tmpl contains any templates allocated to this object.
 */

typedef struct {
    pblock *name;

    int nd;
    dtable *dt;
} httpd_object;




/* ------------------------------ Prototypes ------------------------------ */


/*
 * directive_name2num will return the position of the abbreviated directive
 * dir in the directive table.
 *
 * If dir does not exist in the table, it will return -1.
 */

int directive_name2num(char *dir);


/*
 * directive_num2name returns a string describing directive number num.
 */

const char *directive_num2name(int num);


/*
 * object_create will create a new object and return a pointer to it.
 * It will allocate space for nd directive types and set name accordingly.
 */

httpd_object *object_create(int nd, pblock *name);

/*
 * object_free will free an object and any data associated with it.
 */

void object_free(httpd_object *obj);

/*
 * object_add_directive will add a new directive to the dtable for
 * the directive class at position dc.
 */

void object_add_directive(int dc, pblock *p, pblock *c, httpd_object *obj);


/*
 * object_findnext finds the object configured to follow the given object,
 * and stores the variables in rq->vars. It returns REQ_PROCEED if more
 * objects should be processed, or REQ_NOACTION if it did not find any
 * further objects to process. If something bad happens, REQ_ABORTED is
 * returned.
 *
 * Handles all DIRECTIVE_CONSTRUCT type directives such as NameTrans and
 * AuthType.
 */


/* --------- Prototype moved to req.h because of interdependency ---------- */

#endif