]> granicus.if.org Git - apache/blob - modules/http2/h2_ctx.h
merged latest changes in 2.4.x
[apache] / modules / http2 / h2_ctx.h
1 /* Copyright 2015 greenbytes GmbH (https://www.greenbytes.de)
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15
16 #ifndef __mod_h2__h2_ctx__
17 #define __mod_h2__h2_ctx__
18
19 struct h2_task_env;
20 struct h2_config;
21
22 /**
23  * The h2 module context associated with a connection. 
24  *
25  * It keeps track of the different types of connections:
26  * - those from clients that use HTTP/2 protocol
27  * - those from clients that do not use HTTP/2
28  * - those created by ourself to perform work on HTTP/2 streams
29  */
30 typedef struct h2_ctx {
31     int is_h2;                    /* h2 engine is used */
32     const char *protocol;         /* the protocol negotiated */
33     struct h2_task_env *task_env; /* the h2_task environment or NULL */
34     const char *hostname;         /* hostname negotiated via SNI, optional */
35     server_rec *server;           /* httpd server config selected. */
36     struct h2_config *config;     /* effective config in this context */
37 } h2_ctx;
38
39 h2_ctx *h2_ctx_get(const conn_rec *c);
40 h2_ctx *h2_ctx_rget(const request_rec *r);
41 h2_ctx *h2_ctx_create_for(const conn_rec *c, struct h2_task_env *env);
42
43
44 /* Set the h2 protocol established on this connection context or
45  * NULL when other protocols are in place.
46  */
47 h2_ctx *h2_ctx_protocol_set(h2_ctx *ctx, const char *proto);
48
49 /**
50  * Get the h2 protocol negotiated for this connection, or NULL.
51  */
52 const char *h2_ctx_protocol_get(const conn_rec *c);
53
54 int h2_ctx_is_task(h2_ctx *ctx);
55 int h2_ctx_is_active(h2_ctx *ctx);
56
57 struct h2_task_env *h2_ctx_get_task(h2_ctx *ctx);
58
59 #endif /* defined(__mod_h2__h2_ctx__) */