bottleneck testcase based on rubbos
[bottlenecks.git] / rubbos / app / tomcat-connectors-1.2.32-src / native / common / jk_context.h
1 /*
2  *  Licensed to the Apache Software Foundation (ASF) under one or more
3  *  contributor license agreements.  See the NOTICE file distributed with
4  *  this work for additional information regarding copyright ownership.
5  *  The ASF licenses this file to You under the Apache License, Version 2.0
6  *  (the "License"); you may not use this file except in compliance with
7  *  the License.  You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  */
17
18 /***************************************************************************
19  * Description: Context Stuff (Autoconf)                                   *
20  * Author:      Henri Gomez <hgomez@apache.org>                            *
21  * Version:     $Revision: 466585 $                                           *
22  ***************************************************************************/
23 #ifndef JK_CONTEXT_H
24 #define JK_CONTEXT_H
25
26 #include "jk_pool.h"
27
28 #ifdef __cplusplus
29 extern "C"
30 {
31 #endif                          /* __cplusplus */
32
33 #define CBASE_INC_SIZE   (8)    /* Allocate memory by step of 8 URIs : ie 8 URI by context */
34 #define URI_INC_SIZE (8)        /* Allocate memory by step of 8 CONTEXTs : ie 8 contexts by worker */
35
36 typedef struct
37 {
38
39     /*
40      * Context base (ie examples) 
41      */
42
43     char *cbase;
44
45     /*
46      * Status (Up/Down)
47      */
48
49     int status;
50
51     /*
52      * Num of URI handled 
53      */
54
55     int size;
56
57     /*
58      * Capacity
59      */
60
61     int capacity;
62
63     /*
64      * URL/URIs (autoconf)
65      */
66
67     char **uris;
68 }
69 jk_context_item_t;
70
71
72 typedef struct
73 {
74
75     /*
76      * Memory Pool
77      */
78
79     jk_pool_t p;
80     jk_pool_atom_t buf[SMALL_POOL_SIZE];
81
82     /*
83      * Virtual Server (if use)
84      */
85
86     char *virt;
87
88     /*
89      * Num of context handled (ie: examples, admin...)
90      */
91
92     int size;
93
94     /*
95      * Capacity
96      */
97
98     int capacity;
99
100     /*
101      * Context list, context / URIs
102      */
103
104     jk_context_item_t **contexts;
105 }
106 jk_context_t;
107
108
109 /*
110  * functions defined here 
111  */
112
113 int context_set_virtual(jk_context_t *c, char *virt);
114
115 int context_open(jk_context_t *c, char *virt);
116
117 int context_close(jk_context_t *c);
118
119 int context_alloc(jk_context_t **c, char *virt);
120
121 int context_free(jk_context_t **c);
122
123 jk_context_item_t *context_find_base(jk_context_t *c, char *cbase);
124
125 char *context_item_find_uri(jk_context_item_t *ci, char *uri);
126
127 void context_dump_uris(jk_context_t *c, char *cbase, FILE * f);
128
129 jk_context_item_t *context_add_base(jk_context_t *c, char *cbase);
130
131 int context_add_uri(jk_context_t *c, char *cbase, char *uri);
132
133
134 #ifdef __cplusplus
135 }
136 #endif                          /* __cplusplus */
137
138 #endif                          /* JK_CONTEXT_H */