Blame modules/http2/h2_ctx.h

Packit 90a5c9
/* Licensed to the Apache Software Foundation (ASF) under one or more
Packit 90a5c9
 * contributor license agreements.  See the NOTICE file distributed with
Packit 90a5c9
 * this work for additional information regarding copyright ownership.
Packit 90a5c9
 * The ASF licenses this file to You under the Apache License, Version 2.0
Packit 90a5c9
 * (the "License"); you may not use this file except in compliance with
Packit 90a5c9
 * the License.  You may obtain a copy of the License at
Packit 90a5c9
 *
Packit 90a5c9
 *     http://www.apache.org/licenses/LICENSE-2.0
Packit 90a5c9
 *
Packit 90a5c9
 * Unless required by applicable law or agreed to in writing, software
Packit 90a5c9
 * distributed under the License is distributed on an "AS IS" BASIS,
Packit 90a5c9
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Packit 90a5c9
 * See the License for the specific language governing permissions and
Packit 90a5c9
 * limitations under the License.
Packit 90a5c9
 */
Packit 90a5c9
Packit 90a5c9
#ifndef __mod_h2__h2_ctx__
Packit 90a5c9
#define __mod_h2__h2_ctx__
Packit 90a5c9
Packit 90a5c9
struct h2_session;
Packit 90a5c9
struct h2_task;
Packit 90a5c9
struct h2_config;
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * The h2 module context associated with a connection. 
Packit 90a5c9
 *
Packit 90a5c9
 * It keeps track of the different types of connections:
Packit 90a5c9
 * - those from clients that use HTTP/2 protocol
Packit 90a5c9
 * - those from clients that do not use HTTP/2
Packit 90a5c9
 * - those created by ourself to perform work on HTTP/2 streams
Packit 90a5c9
 */
Packit 90a5c9
typedef struct h2_ctx {
Packit 90a5c9
    const char *protocol;           /* the protocol negotiated */
Packit 90a5c9
    struct h2_session *session;     /* the session established */
Packit 90a5c9
    struct h2_task *task;           /* the h2_task executing or NULL */
Packit 90a5c9
    const char *hostname;           /* hostname negotiated via SNI, optional */
Packit 90a5c9
    server_rec *server;             /* httpd server config selected. */
Packit 90a5c9
    const struct h2_config *config; /* effective config in this context */
Packit 90a5c9
} h2_ctx;
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Get (or create) a h2 context record for this connection.
Packit 90a5c9
 * @param c the connection to look at
Packit 90a5c9
 * @param create != 0 iff missing context shall be created
Packit 90a5c9
 * @return h2 context of this connection
Packit 90a5c9
 */
Packit 90a5c9
h2_ctx *h2_ctx_get(const conn_rec *c, int create);
Packit 90a5c9
void h2_ctx_clear(const conn_rec *c);
Packit 90a5c9
Packit 90a5c9
h2_ctx *h2_ctx_rget(const request_rec *r);
Packit 90a5c9
h2_ctx *h2_ctx_create_for(const conn_rec *c, struct h2_task *task);
Packit 90a5c9
Packit 90a5c9
Packit 90a5c9
/* Set the h2 protocol established on this connection context or
Packit 90a5c9
 * NULL when other protocols are in place.
Packit 90a5c9
 */
Packit 90a5c9
h2_ctx *h2_ctx_protocol_set(h2_ctx *ctx, const char *proto);
Packit 90a5c9
Packit 90a5c9
/* Set the server_rec relevant for this context.
Packit 90a5c9
 */
Packit 90a5c9
h2_ctx *h2_ctx_server_set(h2_ctx *ctx, server_rec *s);
Packit 90a5c9
server_rec *h2_ctx_server_get(h2_ctx *ctx);
Packit 90a5c9
Packit 90a5c9
struct h2_session *h2_ctx_session_get(h2_ctx *ctx);
Packit 90a5c9
void h2_ctx_session_set(h2_ctx *ctx, struct h2_session *session);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Get the h2 protocol negotiated for this connection, or NULL.
Packit 90a5c9
 */
Packit 90a5c9
const char *h2_ctx_protocol_get(const conn_rec *c);
Packit 90a5c9
Packit 90a5c9
int h2_ctx_is_task(h2_ctx *ctx);
Packit 90a5c9
Packit 90a5c9
struct h2_task *h2_ctx_get_task(h2_ctx *ctx);
Packit 90a5c9
struct h2_task *h2_ctx_cget_task(conn_rec *c);
Packit 90a5c9
struct h2_task *h2_ctx_rget_task(request_rec *r);
Packit 90a5c9
Packit 90a5c9
#endif /* defined(__mod_h2__h2_ctx__) */