lsquic_engine_public.h revision 10c492f0
110c492f0SDmitri Tikhonov/* Copyright (c) 2017 - 2018 LiteSpeed Technologies Inc.  See LICENSE. */
250aadb33SDmitri Tikhonov/*
350aadb33SDmitri Tikhonov * lsquic_engine_public.h -- Engine's "public interface"
450aadb33SDmitri Tikhonov *
550aadb33SDmitri Tikhonov */
650aadb33SDmitri Tikhonov
750aadb33SDmitri Tikhonov#ifndef LSQUIC_ENGINE_PUBLIC_H
850aadb33SDmitri Tikhonov#define LSQUIC_ENGINE_PUBLIC_H 1
950aadb33SDmitri Tikhonov
1050aadb33SDmitri Tikhonovstruct lsquic_conn;
1150aadb33SDmitri Tikhonovstruct lsquic_engine;
1250aadb33SDmitri Tikhonov
1350aadb33SDmitri Tikhonovstruct lsquic_engine_public {
1450aadb33SDmitri Tikhonov    struct lsquic_mm                enp_mm;
1550aadb33SDmitri Tikhonov    struct lsquic_engine_settings   enp_settings;
1650aadb33SDmitri Tikhonov    const struct lsquic_packout_mem_if
1750aadb33SDmitri Tikhonov                                   *enp_pmi;
1850aadb33SDmitri Tikhonov    void                           *enp_pmi_ctx;
1950aadb33SDmitri Tikhonov    struct lsquic_engine           *enp_engine;
2050aadb33SDmitri Tikhonov    enum {
2150aadb33SDmitri Tikhonov        ENPUB_PROC  = (1 << 0), /* Being processed by one of the user-facing
2250aadb33SDmitri Tikhonov                                 * functions.
2350aadb33SDmitri Tikhonov                                 */
2450aadb33SDmitri Tikhonov    }                               enp_flags;
2550aadb33SDmitri Tikhonov    unsigned char                   enp_ver_tags_buf[ sizeof(lsquic_ver_tag_t) * N_LSQVER ];
2650aadb33SDmitri Tikhonov    unsigned                        enp_ver_tags_len;
2750aadb33SDmitri Tikhonov};
2850aadb33SDmitri Tikhonov
2950aadb33SDmitri Tikhonov/* These values are printable ASCII characters for ease of printing the
3050aadb33SDmitri Tikhonov * whole history in a single line of a log message.  If connection was
3150aadb33SDmitri Tikhonov * processed as result of being put onto the queue, the letter is converted
3250aadb33SDmitri Tikhonov * to uppercase.
3350aadb33SDmitri Tikhonov *
3450aadb33SDmitri Tikhonov * The letters are assigned by first letter of the verb for most obvious
3550aadb33SDmitri Tikhonov * and important actions, like "read" and "write" and other letters of
3650aadb33SDmitri Tikhonov * the verb or some other letters for other actions.
3750aadb33SDmitri Tikhonov *
3850aadb33SDmitri Tikhonov * Each reason is either expected to produce user read from the stream
3950aadb33SDmitri Tikhonov * or putting stream data into packet for sending out.  This is documented
4050aadb33SDmitri Tikhonov * in a separate comment column below.
4150aadb33SDmitri Tikhonov */
4250aadb33SDmitri Tikhonovenum rw_reason
4350aadb33SDmitri Tikhonov{
4450aadb33SDmitri Tikhonov    RW_REASON_EMPTY         =  '\0',    /* No init required */
4550aadb33SDmitri Tikhonov
4650aadb33SDmitri Tikhonov                                        /* Expected action: */
4750aadb33SDmitri Tikhonov    RW_REASON_USER_WRITE    =  'w',     /* write */
4850aadb33SDmitri Tikhonov    RW_REASON_USER_WRITEV   =  'v',     /* write */
4950aadb33SDmitri Tikhonov    RW_REASON_USER_READ     =  'r',     /* write (WINDOW_UPDATE frame) */
5050aadb33SDmitri Tikhonov    RW_REASON_FLUSH         =  'f',     /* write */
5150aadb33SDmitri Tikhonov    RW_REASON_STREAM_CLOSE  =  'c',     /* write */
5250aadb33SDmitri Tikhonov    RW_REASON_RST_IN        =  'n',     /* read */
5350aadb33SDmitri Tikhonov    RW_REASON_STREAM_IN     =  'd',     /* read */
5450aadb33SDmitri Tikhonov    RW_REASON_RESET_EXT     =  'e',     /* write */
5550aadb33SDmitri Tikhonov    RW_REASON_WANTREAD      =  'a',     /* read */
5650aadb33SDmitri Tikhonov    RW_REASON_SHUTDOWN      =  'u',     /* write */
5750aadb33SDmitri Tikhonov    RW_REASON_WRITEFILE     =  't',     /* write */
5850aadb33SDmitri Tikhonov    RW_REASON_SENDFILE      =  's',     /* write */
5950aadb33SDmitri Tikhonov};
6050aadb33SDmitri Tikhonov
6150aadb33SDmitri Tikhonov/* Put connection onto Pending RW Queue if it is not already on it.  If
6250aadb33SDmitri Tikhonov * connection is being destroyed, this is a no-op.
6350aadb33SDmitri Tikhonov * XXX Is the bit about "being destroyed" still true?
6450aadb33SDmitri Tikhonov */
6550aadb33SDmitri Tikhonovvoid
6650aadb33SDmitri Tikhonovlsquic_engine_add_conn_to_pend_rw (struct lsquic_engine_public *enpub,
6750aadb33SDmitri Tikhonov                                        lsquic_conn_t *conn, enum rw_reason);
6850aadb33SDmitri Tikhonov
6950aadb33SDmitri Tikhonov/* Put connection onto Advisory Tick Time  Queue if it is not already on it.
7050aadb33SDmitri Tikhonov */
7150aadb33SDmitri Tikhonovvoid
7250aadb33SDmitri Tikhonovlsquic_engine_add_conn_to_attq (struct lsquic_engine_public *enpub,
7350aadb33SDmitri Tikhonov                                            lsquic_conn_t *, lsquic_time_t);
7450aadb33SDmitri Tikhonov
7550aadb33SDmitri Tikhonov#endif
76