/* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
*/
typedefenum {
H2_PROXYS_ST_INIT, /* send initial SETTINGS, etc. */
H2_PROXYS_ST_DONE, /* finished, connection close */
H2_PROXYS_ST_IDLE, /* no streams to process */
H2_PROXYS_ST_BUSY, /* read/write without stop */
H2_PROXYS_ST_WAIT, /* waiting for tasks reporting back */
H2_PROXYS_ST_LOCAL_SHUTDOWN, /* we announced GOAWAY */
H2_PROXYS_ST_REMOTE_SHUTDOWN, /* client announced GOAWAY */
} h2_proxys_state;
typedefenum {
H2_PROXYS_EV_INIT, /* session was initialized */
H2_PROXYS_EV_LOCAL_GOAWAY, /* we send a GOAWAY */
H2_PROXYS_EV_REMOTE_GOAWAY, /* remote send us a GOAWAY */
H2_PROXYS_EV_CONN_ERROR, /* connection error */
H2_PROXYS_EV_PROTO_ERROR, /* protocol error */
H2_PROXYS_EV_CONN_TIMEOUT, /* connection timeout */
H2_PROXYS_EV_NO_IO, /* nothing has been read or written */
H2_PROXYS_EV_STREAM_SUBMITTED, /* stream has been submitted */
H2_PROXYS_EV_STREAM_DONE, /* stream has been finished */
H2_PROXYS_EV_STREAM_RESUMED, /* stream signalled availability of headers/data */
H2_PROXYS_EV_DATA_READ, /* connection data has been read */
H2_PROXYS_EV_NGH2_DONE, /* nghttp2 wants neither read nor write anything */
H2_PROXYS_EV_PRE_CLOSE, /* connection will close after this */
} h2_proxys_event_t;
typedefenum {
H2_PING_ST_NONE, /* normal connection mode, ProxyTimeout rules */
H2_PING_ST_AWAIT_ANY, /* waiting for any frame from backend */
H2_PING_ST_AWAIT_PING, /* waiting for PING frame from backend */
} h2_ping_state_t;
typedefstruct h2_proxy_session h2_proxy_session; typedefvoid h2_proxy_request_done(h2_proxy_session *s, request_rec *r,
apr_status_t status, int touched, int error_code);
struct h2_proxy_ihash_t *streams; struct h2_proxy_iqueue *suspended;
apr_size_t remote_max_concurrent; int last_stream_id; /* last stream id processed by backend, or 0 */
apr_time_t last_frame_received;
apr_status_t h2_proxy_session_submit(h2_proxy_session *s, constchar *url,
request_rec *r, int standalone);
/** * Perform a step in processing the proxy session. Will return aftert * one read/write cycle and indicate session status by status code. * @param s the session to process * @return APR_EAGAIN when processing needs to be invoked again * APR_SUCCESS when all streams have been processed, session still live * APR_EOF when the session has been terminated
*/
apr_status_t h2_proxy_session_process(h2_proxy_session *s);