lsquic_engine_public.h revision 10c492f0
1/* Copyright (c) 2017 - 2018 LiteSpeed Technologies Inc.  See LICENSE. */
2/*
3 * lsquic_engine_public.h -- Engine's "public interface"
4 *
5 */
6
7#ifndef LSQUIC_ENGINE_PUBLIC_H
8#define LSQUIC_ENGINE_PUBLIC_H 1
9
10struct lsquic_conn;
11struct lsquic_engine;
12
13struct lsquic_engine_public {
14    struct lsquic_mm                enp_mm;
15    struct lsquic_engine_settings   enp_settings;
16    const struct lsquic_packout_mem_if
17                                   *enp_pmi;
18    void                           *enp_pmi_ctx;
19    struct lsquic_engine           *enp_engine;
20    enum {
21        ENPUB_PROC  = (1 << 0), /* Being processed by one of the user-facing
22                                 * functions.
23                                 */
24    }                               enp_flags;
25    unsigned char                   enp_ver_tags_buf[ sizeof(lsquic_ver_tag_t) * N_LSQVER ];
26    unsigned                        enp_ver_tags_len;
27};
28
29/* These values are printable ASCII characters for ease of printing the
30 * whole history in a single line of a log message.  If connection was
31 * processed as result of being put onto the queue, the letter is converted
32 * to uppercase.
33 *
34 * The letters are assigned by first letter of the verb for most obvious
35 * and important actions, like "read" and "write" and other letters of
36 * the verb or some other letters for other actions.
37 *
38 * Each reason is either expected to produce user read from the stream
39 * or putting stream data into packet for sending out.  This is documented
40 * in a separate comment column below.
41 */
42enum rw_reason
43{
44    RW_REASON_EMPTY         =  '\0',    /* No init required */
45
46                                        /* Expected action: */
47    RW_REASON_USER_WRITE    =  'w',     /* write */
48    RW_REASON_USER_WRITEV   =  'v',     /* write */
49    RW_REASON_USER_READ     =  'r',     /* write (WINDOW_UPDATE frame) */
50    RW_REASON_FLUSH         =  'f',     /* write */
51    RW_REASON_STREAM_CLOSE  =  'c',     /* write */
52    RW_REASON_RST_IN        =  'n',     /* read */
53    RW_REASON_STREAM_IN     =  'd',     /* read */
54    RW_REASON_RESET_EXT     =  'e',     /* write */
55    RW_REASON_WANTREAD      =  'a',     /* read */
56    RW_REASON_SHUTDOWN      =  'u',     /* write */
57    RW_REASON_WRITEFILE     =  't',     /* write */
58    RW_REASON_SENDFILE      =  's',     /* write */
59};
60
61/* Put connection onto Pending RW Queue if it is not already on it.  If
62 * connection is being destroyed, this is a no-op.
63 * XXX Is the bit about "being destroyed" still true?
64 */
65void
66lsquic_engine_add_conn_to_pend_rw (struct lsquic_engine_public *enpub,
67                                        lsquic_conn_t *conn, enum rw_reason);
68
69/* Put connection onto Advisory Tick Time  Queue if it is not already on it.
70 */
71void
72lsquic_engine_add_conn_to_attq (struct lsquic_engine_public *enpub,
73                                            lsquic_conn_t *, lsquic_time_t);
74
75#endif
76