Blame modules/http2/h2_conn_io.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_conn_io__
Packit 90a5c9
#define __mod_h2__h2_conn_io__
Packit 90a5c9
Packit 90a5c9
struct h2_config;
Packit 90a5c9
struct h2_session;
Packit 90a5c9
Packit 90a5c9
/* h2_io is the basic handler of a httpd connection. It keeps two brigades,
Packit 90a5c9
 * one for input, one for output and works with the installed connection
Packit 90a5c9
 * filters.
Packit 90a5c9
 * The read is done via a callback function, so that input can be processed
Packit 90a5c9
 * directly without copying.
Packit 90a5c9
 */
Packit 90a5c9
typedef struct {
Packit 90a5c9
    conn_rec *c;
Packit 90a5c9
    apr_bucket_brigade *output;
Packit 90a5c9
Packit 90a5c9
    int is_tls;
Packit 90a5c9
    apr_time_t cooldown_usecs;
Packit 90a5c9
    apr_int64_t warmup_size;
Packit 90a5c9
    
Packit 90a5c9
    apr_size_t write_size;
Packit 90a5c9
    apr_time_t last_write;
Packit 90a5c9
    apr_int64_t bytes_read;
Packit 90a5c9
    apr_int64_t bytes_written;
Packit 90a5c9
    
Packit 90a5c9
    int buffer_output;
Packit 90a5c9
    apr_size_t flush_threshold;
Packit 90a5c9
    unsigned int is_flushed : 1;
Packit 90a5c9
    
Packit 90a5c9
    char *scratch;
Packit 90a5c9
    apr_size_t ssize;
Packit 90a5c9
    apr_size_t slen;
Packit 90a5c9
} h2_conn_io;
Packit 90a5c9
Packit 90a5c9
apr_status_t h2_conn_io_init(h2_conn_io *io, conn_rec *c, 
Packit 90a5c9
                             const struct h2_config *cfg);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Append data to the buffered output.
Packit 90a5c9
 * @param buf the data to append
Packit 90a5c9
 * @param length the length of the data to append
Packit 90a5c9
 */
Packit 90a5c9
apr_status_t h2_conn_io_write(h2_conn_io *io,
Packit 90a5c9
                         const char *buf,
Packit 90a5c9
                         size_t length);
Packit 90a5c9
Packit 90a5c9
apr_status_t h2_conn_io_pass(h2_conn_io *io, apr_bucket_brigade *bb);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Pass any buffered data on to the connection output filters.
Packit 90a5c9
 * @param io the connection io
Packit 90a5c9
 * @param flush if a flush bucket should be appended to any output
Packit 90a5c9
 */
Packit 90a5c9
apr_status_t h2_conn_io_flush(h2_conn_io *io);
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Check if the buffered amount of data needs flushing.
Packit 90a5c9
 */
Packit 90a5c9
int h2_conn_io_needs_flush(h2_conn_io *io);
Packit 90a5c9
Packit 90a5c9
#endif /* defined(__mod_h2__h2_conn_io__) */