2 * Copyright (c) 1994, 1995. Netscape Communications Corporation. All
5 * Use of this software is governed by the terms of the license agreement for
6 * the Netscape Communications or Netscape Comemrce Server between the
11 /* ------------------------------------------------------------------------ */
15 * objset.h: Handles object sets
17 * Each object is produced by reading a config file of some form. See the
18 * server documentation for descriptions of the directives that are
19 * recognized, what they do, and how they are parsed.
21 * This module requires the pblock and buffer modules from the base library.
31 #include <nt/ntobjset.h>
36 #include "base/pblock.h"
37 #include "base/buffer.h"
38 #include "frame/object.h"
41 /* ------------------------------ Constants ------------------------------- */
45 * The default number of objects to leave room for in an object set,
46 * and the number of new entries by which to increase the size when that
50 #define OBJSET_INCSIZE 8
53 * When parsing config. files, httpd will put a limit on how long
54 * the parameters to a directive can be (in characters).
56 * Currently set to 10 lines (80 chars/line).
59 #define MAX_DIRECTIVE_LEN 800
62 * The size of the hash tables that store a directive's parameters
65 #define PARAMETER_HASH_SIZE 3
68 /* ------------------------------ Structures ------------------------------ */
72 * httpd_objset is a container for a bunch of objects. obj is a
73 * NULL-terminated array of objects. pos points to the entry after the last
74 * one in the array. You should not mess with pos, but can read it to find
84 /* ------------------------------ Prototypes ------------------------------ */
88 * objset_scan_buffer will scan through buffer, looking for object
89 * configuration information, and adding them to the object set os if it
90 * finds any. If os is NULL it will allocate a new object set.
92 * If any error occurs (syntax error, premature EOF) this function will
93 * free os, print an error message into errstr, and return NULL.
94 * This is because a config. file error is viewed as a catastrophic error
95 * from which httpd should not try to recover. If httpd were to continue
96 * after an error, it would not behave as the admin. expected and he/she
97 * may not notice until it's too late.
99 * Upon EOF the file will not be closed.
102 httpd_objset
*objset_scan_buffer(filebuf
*buf
, char *errstr
, httpd_objset
*os
);
105 * objset_create creates a new object set and returns a pointer to it.
108 httpd_objset
*objset_create();
111 * objset_free will free an object set and any associated objects.
114 void objset_free(httpd_objset
*os
);
117 * objset_free_setonly frees only the object set.
119 void objset_free_setonly(httpd_objset
*os
);
122 * objset_new_object will add a new object to objset with the specified
123 * name. It returns a pointer to the new object (which may be anywhere in
127 httpd_object
*objset_new_object(pblock
*name
, httpd_objset
*os
);
130 * objset_add_object will add the existing object to os.
133 void objset_add_object(httpd_object
*obj
, httpd_objset
*os
);
136 * objset_findbyname will find the object in objset having the given name,
137 * and return the object if found, and NULL otherwise.
138 * ign is a set of objects to ignore.
141 httpd_object
*objset_findbyname(char *name
, httpd_objset
*ign
,
145 * objset_findbyppath will find the object in objset having the given
146 * partial path entry. Returns object if found, NULL otherwise.
147 * ign is a set of objects to ignore.
150 httpd_object
*objset_findbyppath(char *ppath
, httpd_objset
*ign
,