diff --git a/CHANGELOG b/CHANGELOG index b65465e..8656f22 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +2017-09-28 + + - Add support for Q041; drop support for Q040 + 2017-09-27 - Fix CMakeLists.txt: BoringSSL include and lib was mixed up diff --git a/README.md b/README.md index 6704edd..23857ae 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ our own products: LiteSpeed Web Server and ADC. We think it is free of major problems. Nevertheless, do not hesitate to report bugs back to us. Even better, send us fixes and improvements! -Currently supported QUIC versions are Q035, Q037, Q038, Q039, and Q040. +Currently supported QUIC versions are Q035, Q037, Q038, Q039, and Q041. Support for newer versions will be added soon after they are released. The version(s) specified by IETF QUIC WG will be added once the IETF version of the protocol settles down a little. diff --git a/docs/html/globals.html b/docs/html/globals.html index cbc7656..2444ebc 100644 --- a/docs/html/globals.html +++ b/docs/html/globals.html @@ -335,8 +335,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • LSQVER_039 : lsquic.h
  • -
  • LSQVER_040 -: lsquic.h +
  • LSQVER_041 +: lsquic.h
  • diff --git a/docs/html/globals_eval.html b/docs/html/globals_eval.html index 0dbf589..ad01220 100644 --- a/docs/html/globals_eval.html +++ b/docs/html/globals_eval.html @@ -118,8 +118,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • LSQVER_039 : lsquic.h
  • -
  • LSQVER_040 -: lsquic.h +
  • LSQVER_041 +: lsquic.h
  • diff --git a/docs/html/lsquic_8h.html b/docs/html/lsquic_8h.html index d72b448..b1f469b 100644 --- a/docs/html/lsquic_8h.html +++ b/docs/html/lsquic_8h.html @@ -142,7 +142,7 @@ Macros #define LSQUIC_SUPPORTED_VERSIONS   -#define LSQUIC_EXPERIMENTAL_VERSIONS   ((1 << LSQVER_040)) +#define LSQUIC_EXPERIMENTAL_VERSIONS   ((1 << LSQVER_041))   #define LSQUIC_MIN_FCW   (16 * 1024)   @@ -232,7 +232,7 @@ Enumerations LSQVER_038, LSQVER_039,
    -  LSQVER_040, +  LSQVER_041, N_LSQVER
    } @@ -599,11 +599,11 @@ int lsquic_conn_get_sockad
    -Value:
    ((1 << LSQVER_035) | (1 << LSQVER_037) | \
    (1 << LSQVER_038) | (1 << LSQVER_039) | (1 << LSQVER_040))
    Definition: lsquic.h:54
    -
    Definition: lsquic.h:72
    +Value:
    ((1 << LSQVER_035) | (1 << LSQVER_037) | \
    (1 << LSQVER_038) | (1 << LSQVER_039) | (1 << LSQVER_041))
    Definition: lsquic.h:54
    Definition: lsquic.h:67
    Definition: lsquic.h:46
    Definition: lsquic.h:60
    +
    Definition: lsquic.h:72

    We currently support versions 35, 37, 38, 39, and 40.

    See also
    lsquic_version
    @@ -678,8 +678,8 @@ int lsquic_conn_get_sockad LSQVER_039 

    Q039. Switch to big endian. Do not ack acks. Send connection level WINDOW_UPDATE frame every 20 sent packets which do not contain retransmittable frames.

    -LSQVER_040  -

    Q040. RST_STREAM, ACK and STREAM frames match IETF format.

    +LSQVER_041  +

    Q041. RST_STREAM, ACK and STREAM frames match IETF format.

    diff --git a/docs/html/lsquic_8h_source.html b/docs/html/lsquic_8h_source.html index 0b66825..ac77095 100644 --- a/docs/html/lsquic_8h_source.html +++ b/docs/html/lsquic_8h_source.html @@ -88,7 +88,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    lsquic.h
    -Go to the documentation of this file.
    1 /* Copyright (c) 2017 LiteSpeed Technologies Inc. See LICENSE. */
    2 #ifndef __LSQUIC_H__
    3 #define __LSQUIC_H__
    4 
    11 #include <stdarg.h>
    12 #include <lsquic_types.h>
    13 #include <sys/uio.h>
    14 #include <sys/types.h>
    15 #include <time.h>
    16 
    17 struct iovec;
    18 struct sockaddr;
    19 
    20 #ifdef __cplusplus
    21 extern "C" {
    22 #endif
    23 
    29 #define LSENG_SERVER (1 << 0)
    30 
    34 #define LSENG_HTTP (1 << 1)
    35 
    36 #define LSENG_HTTP_SERVER (LSENG_SERVER|LSENG_HTTP)
    37 
    43 {
    44 
    47 
    55 
    61 
    68 
    73 
    74  N_LSQVER
    75 };
    76 
    81 #define LSQUIC_SUPPORTED_VERSIONS ((1 << LSQVER_035) | (1 << LSQVER_037) | \
    82  (1 << LSQVER_038) | (1 << LSQVER_039) | (1 << LSQVER_040))
    83 
    84 #define LSQUIC_EXPERIMENTAL_VERSIONS ((1 << LSQVER_040))
    85 
    93 
    98  lsquic_conn_ctx_t *(*on_new_conn)(void *stream_if_ctx,
    99  lsquic_conn_t *c);
    100 
    105  void (*on_conn_closed)(lsquic_conn_t *c);
    106 
    115  (*on_new_stream)(void *stream_if_ctx, lsquic_stream_t *s);
    116 
    117  void (*on_read) (lsquic_stream_t *s, lsquic_stream_ctx_t *h);
    118  void (*on_write) (lsquic_stream_t *s, lsquic_stream_ctx_t *h);
    119  void (*on_close) (lsquic_stream_t *s, lsquic_stream_ctx_t *h);
    120 };
    121 
    127 #define LSQUIC_MIN_FCW (16 * 1024)
    128 
    129 /* Each LSQUIC_DF_* value corresponds to es_* entry in
    130  * lsquic_engine_settings below.
    131  */
    132 
    136 #define LSQUIC_DF_VERSIONS (LSQUIC_SUPPORTED_VERSIONS & \
    137  ~LSQUIC_EXPERIMENTAL_VERSIONS)
    138 
    139 #define LSQUIC_DF_CFCW_SERVER (3 * 1024 * 1024 / 2)
    140 #define LSQUIC_DF_CFCW_CLIENT (15 * 1024 * 1024)
    141 #define LSQUIC_DF_SFCW_SERVER (1 * 1024 * 1024)
    142 #define LSQUIC_DF_SFCW_CLIENT (6 * 1024 * 1024)
    143 #define LSQUIC_DF_MAX_STREAMS_IN 100
    144 
    148 #define LSQUIC_DF_HANDSHAKE_TO (10 * 1000 * 1000)
    149 
    150 #define LSQUIC_DF_IDLE_CONN_TO (30 * 1000 * 1000)
    151 #define LSQUIC_DF_SILENT_CLOSE 1
    152 
    157 #define LSQUIC_DF_MAX_HEADER_LIST_SIZE 0
    158 
    160 #define LSQUIC_DF_UA "LSQUIC"
    161 
    162 #define LSQUIC_DF_STTL 86400
    163 #define LSQUIC_DF_MAX_INCHOATE (1 * 1000 * 1000)
    164 #define LSQUIC_DF_SUPPORT_SREJ_SERVER 1
    165 #define LSQUIC_DF_SUPPORT_SREJ_CLIENT 0 /* TODO: client support */
    166 
    167 #define LSQUIC_DF_SUPPORT_NSTP 0
    168 #define LSQUIC_DF_SUPPORT_PUSH 1
    169 #define LSQUIC_DF_SUPPORT_TCID0 1
    170 
    171 #define LSQUIC_DF_HONOR_PRST 0
    172 
    174 #define LSQUIC_DF_PROGRESS_CHECK 1000
    175 
    177 #define LSQUIC_DF_PENDRW_CHECK 10
    178 
    180 #define LSQUIC_DF_RW_ONCE 0
    181 
    183 #define LSQUIC_DF_PROC_TIME_THRESH 0
    184 
    186 #define LSQUIC_DF_PACE_PACKETS 1
    187 
    197  unsigned es_versions;
    198 
    209  unsigned es_cfcw;
    210 
    221  unsigned es_sfcw;
    222 
    231  unsigned es_max_cfcw;
    232 
    233  unsigned es_max_sfcw;
    234 
    237 
    245  unsigned long es_handshake_to;
    246 
    248  unsigned long es_idle_conn_to;
    249 
    252 
    259 
    261  const char *es_ua;
    262 
    263  uint32_t es_pdmd; /* One fixed value X509 */
    264  uint32_t es_aead; /* One fixed value AESG */
    265  uint32_t es_kexs; /* One fixed value C255 */
    266 
    273 
    285 
    294 
    306 
    313 
    328 
    344  unsigned es_pendrw_check;
    345 
    359 
    379 
    386 
    387 };
    388 
    389 /* Initialize `settings' to default values */
    390 void
    391 lsquic_engine_init_settings (struct lsquic_engine_settings *,
    392  unsigned lsquic_engine_flags);
    393 
    410 int
    412  unsigned lsquic_engine_flags,
    413  char *err_buf, size_t err_buf_sz);
    414 
    416 {
    417  const unsigned char *buf;
    418  size_t sz;
    419  const struct sockaddr *local_sa;
    420  const struct sockaddr *dest_sa;
    421  void *peer_ctx;
    422 };
    423 
    428 typedef int (*lsquic_packets_out_f)(
    429  void *packets_out_ctx,
    430  const struct lsquic_out_spec *out_spec,
    431  unsigned n_packets_out
    432 );
    433 
    444 {
    445  void * (*pmi_allocate) (void *pmi_ctx, size_t sz);
    446  void (*pmi_release) (void *pmi_ctx, void *obj);
    447 };
    448 
    449 /* TODO: describe this important data structure */
    450 typedef struct lsquic_engine_api
    451 {
    452  const struct lsquic_engine_settings *ea_settings; /* Optional */
    453  const struct lsquic_stream_if *ea_stream_if;
    454  void *ea_stream_if_ctx;
    455  lsquic_packets_out_f ea_packets_out;
    456  void *ea_packets_out_ctx;
    461  void *ea_pmi_ctx;
    463 
    471 lsquic_engine_new (unsigned lsquic_engine_flags,
    472  const struct lsquic_engine_api *);
    473 
    479 int
    480 lsquic_engine_connect (lsquic_engine_t *, const struct sockaddr *peer_sa,
    481  void *peer_ctx, const char *hostname,
    482  unsigned short max_packet_size);
    483 
    494 int
    496  const unsigned char *packet_in_data, size_t packet_in_size,
    497  const struct sockaddr *sa_local, const struct sockaddr *sa_peer,
    498  void *peer_ctx);
    499 
    504 void
    506 
    511 void
    513 
    518 void
    520 
    536 int
    538 
    543 void
    545 
    550 int
    552 
    557 void
    559 
    560 void
    561 lsquic_engine_destroy (lsquic_engine_t *);
    562 
    563 void lsquic_conn_make_stream(lsquic_conn_t *);
    564 
    566 unsigned
    568 
    570 unsigned
    572 
    577 void
    579 
    584 void lsquic_conn_close(lsquic_conn_t *conn);
    585 
    586 int lsquic_stream_wantread(lsquic_stream_t *s, int is_want);
    587 ssize_t lsquic_stream_read(lsquic_stream_t *s, void *buf, size_t len);
    588 ssize_t lsquic_stream_readv(lsquic_stream_t *s, const struct iovec *,
    589  int iovcnt);
    590 
    591 int lsquic_stream_wantwrite(lsquic_stream_t *s, int is_want);
    592 
    598 
    604 ssize_t lsquic_stream_write(lsquic_stream_t *s, const void *buf, size_t len);
    605 
    612 int lsquic_stream_write_file(lsquic_stream_t *s, const char *filename);
    613 
    614 ssize_t lsquic_stream_writev(lsquic_stream_t *s, const struct iovec *vec, int count);
    615 
    621 int lsquic_stream_sendfile(lsquic_stream_t *s, int fdSrc, off_t off, size_t size);
    622 
    623 int lsquic_stream_flush(lsquic_stream_t *s);
    624 
    630 typedef struct lsquic_http_header
    631 {
    632  struct iovec name;
    633  struct iovec value;
    635 
    642 {
    643  int count;
    644  lsquic_http_header_t *headers;
    645 };
    646 
    647 int lsquic_stream_send_headers(lsquic_stream_t *s,
    648  const lsquic_http_headers_t *h, int eos);
    649 
    650 int lsquic_conn_is_push_enabled(lsquic_conn_t *c);
    651 
    653 int lsquic_stream_shutdown(lsquic_stream_t *s, int how);
    654 
    655 int lsquic_stream_close(lsquic_stream_t *s);
    656 
    658 uint32_t
    660 
    667 
    669 int
    671 
    679 int
    681 
    694 int
    695 lsquic_stream_push_info (const lsquic_stream_t *, uint32_t *ref_stream_id,
    696  const char **headers, size_t *headers_sz);
    697 
    699 unsigned lsquic_stream_priority (const lsquic_stream_t *s);
    700 
    707 int lsquic_stream_set_priority (lsquic_stream_t *s, unsigned priority);
    708 
    714 
    716 lsquic_conn_get_stream_by_id (lsquic_conn_t *c, uint32_t stream_id);
    717 
    720 lsquic_conn_id (const lsquic_conn_t *c);
    721 
    722 int lsquic_conn_get_sockaddr(const lsquic_conn_t *c,
    723  const struct sockaddr **local, const struct sockaddr **peer);
    724 
    726  int (*vprintf)(void *logger_ctx, const char *fmt, va_list args);
    727 };
    728 
    737 
    743 
    748 
    758 
    764 
    765  N_LLTS
    766 };
    767 
    772 void lsquic_logger_init(const struct lsquic_logger_if *, void *logger_ctx,
    774 
    782 int
    783 lsquic_set_log_level (const char *log_level);
    784 
    788 int
    789 lsquic_logger_lopt (const char *optarg);
    790 
    796 
    801 #define LSQUIC_GLOBAL_CLIENT (1 << 0)
    802 
    807 #define LSQUIC_GLOBAL_SERVER (1 << 1)
    808 
    823 int
    824 lsquic_global_init (int flags);
    825 
    830 void
    831 lsquic_global_cleanup (void);
    832 
    838 enum lsquic_version
    840 
    842 enum lsquic_version
    843 lsquic_str2ver (const char *str, size_t len);
    844 
    850 
    854 void *lsquic_conn_get_peer_ctx( const lsquic_conn_t *lconn);
    855 
    859 void
    861 
    868 int
    870 
    875 unsigned
    876 lsquic_engine_count_attq (lsquic_engine_t *engine, int from_now);
    877 
    878 #ifdef __cplusplus
    879 }
    880 #endif
    881 
    882 #endif //__LSQUIC_H__
    883 
    int lsquic_engine_has_pend_rw(lsquic_engine_t *)
    +Go to the documentation of this file.
    1 /* Copyright (c) 2017 LiteSpeed Technologies Inc. See LICENSE. */
    2 #ifndef __LSQUIC_H__
    3 #define __LSQUIC_H__
    4 
    11 #include <stdarg.h>
    12 #include <lsquic_types.h>
    13 #include <sys/uio.h>
    14 #include <sys/types.h>
    15 #include <time.h>
    16 
    17 struct iovec;
    18 struct sockaddr;
    19 
    20 #ifdef __cplusplus
    21 extern "C" {
    22 #endif
    23 
    29 #define LSENG_SERVER (1 << 0)
    30 
    34 #define LSENG_HTTP (1 << 1)
    35 
    36 #define LSENG_HTTP_SERVER (LSENG_SERVER|LSENG_HTTP)
    37 
    43 {
    44 
    47 
    55 
    61 
    68 
    73 
    74  N_LSQVER
    75 };
    76 
    81 #define LSQUIC_SUPPORTED_VERSIONS ((1 << LSQVER_035) | (1 << LSQVER_037) | \
    82  (1 << LSQVER_038) | (1 << LSQVER_039) | (1 << LSQVER_041))
    83 
    84 #define LSQUIC_EXPERIMENTAL_VERSIONS ((1 << LSQVER_041))
    85 
    93 
    98  lsquic_conn_ctx_t *(*on_new_conn)(void *stream_if_ctx,
    99  lsquic_conn_t *c);
    100 
    105  void (*on_conn_closed)(lsquic_conn_t *c);
    106 
    115  (*on_new_stream)(void *stream_if_ctx, lsquic_stream_t *s);
    116 
    117  void (*on_read) (lsquic_stream_t *s, lsquic_stream_ctx_t *h);
    118  void (*on_write) (lsquic_stream_t *s, lsquic_stream_ctx_t *h);
    119  void (*on_close) (lsquic_stream_t *s, lsquic_stream_ctx_t *h);
    120 };
    121 
    127 #define LSQUIC_MIN_FCW (16 * 1024)
    128 
    129 /* Each LSQUIC_DF_* value corresponds to es_* entry in
    130  * lsquic_engine_settings below.
    131  */
    132 
    136 #define LSQUIC_DF_VERSIONS (LSQUIC_SUPPORTED_VERSIONS & \
    137  ~LSQUIC_EXPERIMENTAL_VERSIONS)
    138 
    139 #define LSQUIC_DF_CFCW_SERVER (3 * 1024 * 1024 / 2)
    140 #define LSQUIC_DF_CFCW_CLIENT (15 * 1024 * 1024)
    141 #define LSQUIC_DF_SFCW_SERVER (1 * 1024 * 1024)
    142 #define LSQUIC_DF_SFCW_CLIENT (6 * 1024 * 1024)
    143 #define LSQUIC_DF_MAX_STREAMS_IN 100
    144 
    148 #define LSQUIC_DF_HANDSHAKE_TO (10 * 1000 * 1000)
    149 
    150 #define LSQUIC_DF_IDLE_CONN_TO (30 * 1000 * 1000)
    151 #define LSQUIC_DF_SILENT_CLOSE 1
    152 
    157 #define LSQUIC_DF_MAX_HEADER_LIST_SIZE 0
    158 
    160 #define LSQUIC_DF_UA "LSQUIC"
    161 
    162 #define LSQUIC_DF_STTL 86400
    163 #define LSQUIC_DF_MAX_INCHOATE (1 * 1000 * 1000)
    164 #define LSQUIC_DF_SUPPORT_SREJ_SERVER 1
    165 #define LSQUIC_DF_SUPPORT_SREJ_CLIENT 0 /* TODO: client support */
    166 
    167 #define LSQUIC_DF_SUPPORT_NSTP 0
    168 #define LSQUIC_DF_SUPPORT_PUSH 1
    169 #define LSQUIC_DF_SUPPORT_TCID0 1
    170 
    171 #define LSQUIC_DF_HONOR_PRST 0
    172 
    174 #define LSQUIC_DF_PROGRESS_CHECK 1000
    175 
    177 #define LSQUIC_DF_PENDRW_CHECK 10
    178 
    180 #define LSQUIC_DF_RW_ONCE 0
    181 
    183 #define LSQUIC_DF_PROC_TIME_THRESH 0
    184 
    186 #define LSQUIC_DF_PACE_PACKETS 1
    187 
    197  unsigned es_versions;
    198 
    209  unsigned es_cfcw;
    210 
    221  unsigned es_sfcw;
    222 
    231  unsigned es_max_cfcw;
    232 
    233  unsigned es_max_sfcw;
    234 
    237 
    245  unsigned long es_handshake_to;
    246 
    248  unsigned long es_idle_conn_to;
    249 
    252 
    259 
    261  const char *es_ua;
    262 
    263  uint32_t es_pdmd; /* One fixed value X509 */
    264  uint32_t es_aead; /* One fixed value AESG */
    265  uint32_t es_kexs; /* One fixed value C255 */
    266 
    273 
    285 
    294 
    306 
    313 
    328 
    344  unsigned es_pendrw_check;
    345 
    359 
    379 
    386 
    387 };
    388 
    389 /* Initialize `settings' to default values */
    390 void
    391 lsquic_engine_init_settings (struct lsquic_engine_settings *,
    392  unsigned lsquic_engine_flags);
    393 
    410 int
    412  unsigned lsquic_engine_flags,
    413  char *err_buf, size_t err_buf_sz);
    414 
    416 {
    417  const unsigned char *buf;
    418  size_t sz;
    419  const struct sockaddr *local_sa;
    420  const struct sockaddr *dest_sa;
    421  void *peer_ctx;
    422 };
    423 
    428 typedef int (*lsquic_packets_out_f)(
    429  void *packets_out_ctx,
    430  const struct lsquic_out_spec *out_spec,
    431  unsigned n_packets_out
    432 );
    433 
    444 {
    445  void * (*pmi_allocate) (void *pmi_ctx, size_t sz);
    446  void (*pmi_release) (void *pmi_ctx, void *obj);
    447 };
    448 
    449 /* TODO: describe this important data structure */
    450 typedef struct lsquic_engine_api
    451 {
    452  const struct lsquic_engine_settings *ea_settings; /* Optional */
    453  const struct lsquic_stream_if *ea_stream_if;
    454  void *ea_stream_if_ctx;
    455  lsquic_packets_out_f ea_packets_out;
    456  void *ea_packets_out_ctx;
    461  void *ea_pmi_ctx;
    463 
    471 lsquic_engine_new (unsigned lsquic_engine_flags,
    472  const struct lsquic_engine_api *);
    473 
    479 int
    480 lsquic_engine_connect (lsquic_engine_t *, const struct sockaddr *peer_sa,
    481  void *peer_ctx, const char *hostname,
    482  unsigned short max_packet_size);
    483 
    494 int
    496  const unsigned char *packet_in_data, size_t packet_in_size,
    497  const struct sockaddr *sa_local, const struct sockaddr *sa_peer,
    498  void *peer_ctx);
    499 
    504 void
    506 
    511 void
    513 
    518 void
    520 
    536 int
    538 
    543 void
    545 
    550 int
    552 
    557 void
    559 
    560 void
    561 lsquic_engine_destroy (lsquic_engine_t *);
    562 
    563 void lsquic_conn_make_stream(lsquic_conn_t *);
    564 
    566 unsigned
    568 
    570 unsigned
    572 
    577 void
    579 
    584 void lsquic_conn_close(lsquic_conn_t *conn);
    585 
    586 int lsquic_stream_wantread(lsquic_stream_t *s, int is_want);
    587 ssize_t lsquic_stream_read(lsquic_stream_t *s, void *buf, size_t len);
    588 ssize_t lsquic_stream_readv(lsquic_stream_t *s, const struct iovec *,
    589  int iovcnt);
    590 
    591 int lsquic_stream_wantwrite(lsquic_stream_t *s, int is_want);
    592 
    598 
    604 ssize_t lsquic_stream_write(lsquic_stream_t *s, const void *buf, size_t len);
    605 
    612 int lsquic_stream_write_file(lsquic_stream_t *s, const char *filename);
    613 
    614 ssize_t lsquic_stream_writev(lsquic_stream_t *s, const struct iovec *vec, int count);
    615 
    621 int lsquic_stream_sendfile(lsquic_stream_t *s, int fdSrc, off_t off, size_t size);
    622 
    623 int lsquic_stream_flush(lsquic_stream_t *s);
    624 
    630 typedef struct lsquic_http_header
    631 {
    632  struct iovec name;
    633  struct iovec value;
    635 
    642 {
    643  int count;
    644  lsquic_http_header_t *headers;
    645 };
    646 
    647 int lsquic_stream_send_headers(lsquic_stream_t *s,
    648  const lsquic_http_headers_t *h, int eos);
    649 
    650 int lsquic_conn_is_push_enabled(lsquic_conn_t *c);
    651 
    653 int lsquic_stream_shutdown(lsquic_stream_t *s, int how);
    654 
    655 int lsquic_stream_close(lsquic_stream_t *s);
    656 
    658 uint32_t
    660 
    667 
    669 int
    671 
    679 int
    681 
    694 int
    695 lsquic_stream_push_info (const lsquic_stream_t *, uint32_t *ref_stream_id,
    696  const char **headers, size_t *headers_sz);
    697 
    699 unsigned lsquic_stream_priority (const lsquic_stream_t *s);
    700 
    707 int lsquic_stream_set_priority (lsquic_stream_t *s, unsigned priority);
    708 
    714 
    716 lsquic_conn_get_stream_by_id (lsquic_conn_t *c, uint32_t stream_id);
    717 
    720 lsquic_conn_id (const lsquic_conn_t *c);
    721 
    722 int lsquic_conn_get_sockaddr(const lsquic_conn_t *c,
    723  const struct sockaddr **local, const struct sockaddr **peer);
    724 
    726  int (*vprintf)(void *logger_ctx, const char *fmt, va_list args);
    727 };
    728 
    737 
    743 
    748 
    758 
    764 
    765  N_LLTS
    766 };
    767 
    772 void lsquic_logger_init(const struct lsquic_logger_if *, void *logger_ctx,
    774 
    782 int
    783 lsquic_set_log_level (const char *log_level);
    784 
    788 int
    789 lsquic_logger_lopt (const char *optarg);
    790 
    796 
    801 #define LSQUIC_GLOBAL_CLIENT (1 << 0)
    802 
    807 #define LSQUIC_GLOBAL_SERVER (1 << 1)
    808 
    823 int
    824 lsquic_global_init (int flags);
    825 
    830 void
    831 lsquic_global_cleanup (void);
    832 
    838 enum lsquic_version
    840 
    842 enum lsquic_version
    843 lsquic_str2ver (const char *str, size_t len);
    844 
    850 
    854 void *lsquic_conn_get_peer_ctx( const lsquic_conn_t *lconn);
    855 
    859 void
    861 
    868 int
    870 
    875 unsigned
    876 lsquic_engine_count_attq (lsquic_engine_t *engine, int from_now);
    877 
    878 #ifdef __cplusplus
    879 }
    880 #endif
    881 
    882 #endif //__LSQUIC_H__
    883 
    int lsquic_engine_has_pend_rw(lsquic_engine_t *)
    void lsquic_global_cleanup(void)
    unsigned es_max_cfcw
    Definition: lsquic.h:231
    unsigned lsquic_engine_quic_versions(const lsquic_engine_t *)
    @@ -98,7 +98,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    void lsquic_engine_send_unsent_packets(lsquic_engine_t *engine)
    Definition: lsquic.h:54
    unsigned es_pendrw_check
    Definition: lsquic.h:344
    -
    Definition: lsquic.h:72
    int lsquic_engine_earliest_adv_tick(lsquic_engine_t *engine, int *diff)
    Definition: lsquic.h:415
    Definition: lsquic.h:747
    @@ -176,6 +175,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    Definition: lsquic.h:60
    uint32_t lsquic_stream_id(const lsquic_stream_t *s)
    void(* on_goaway_received)(lsquic_conn_t *c)
    Definition: lsquic.h:104
    +
    Definition: lsquic.h:72
    unsigned es_progress_check
    Definition: lsquic.h:327
    int es_support_push
    Definition: lsquic.h:284
    unsigned lsquic_conn_n_pending_streams(const lsquic_conn_t *)
    diff --git a/docs/html/lsquic__types_8h.html b/docs/html/lsquic__types_8h.html index b7b0bf9..f253226 100644 --- a/docs/html/lsquic__types_8h.html +++ b/docs/html/lsquic__types_8h.html @@ -95,8 +95,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); Include dependency graph for lsquic_types.h:
    - -
    This graph shows which files directly or indirectly include this file:
    diff --git a/docs/html/search/all_1.js b/docs/html/search/all_1.js index 06fa750..715bb57 100644 --- a/docs/html/search/all_1.js +++ b/docs/html/search/all_1.js @@ -89,5 +89,5 @@ var searchData= ['lsqver_5f037',['LSQVER_037',['../lsquic_8h.html#a2633ae9ee8d564f4c499f6eb0913d4dba5c2aa78b22ea462ae839566e19a87ea7',1,'lsquic.h']]], ['lsqver_5f038',['LSQVER_038',['../lsquic_8h.html#a2633ae9ee8d564f4c499f6eb0913d4dba2d39809298e0c7866b21fc7932504966',1,'lsquic.h']]], ['lsqver_5f039',['LSQVER_039',['../lsquic_8h.html#a2633ae9ee8d564f4c499f6eb0913d4dbaa9b8bed8ca169e8a3762308cbf0f3af3',1,'lsquic.h']]], - ['lsqver_5f040',['LSQVER_040',['../lsquic_8h.html#a2633ae9ee8d564f4c499f6eb0913d4dbac17f226a6a4c61377a5e50710d5ef12f',1,'lsquic.h']]] + ['lsqver_5f041',['LSQVER_041',['../lsquic_8h.html#a2633ae9ee8d564f4c499f6eb0913d4dbac673a00564784af03b3b9cb747ed8af3',1,'lsquic.h']]] ]; diff --git a/docs/html/search/enumvalues_0.js b/docs/html/search/enumvalues_0.js index ac2c758..fb40778 100644 --- a/docs/html/search/enumvalues_0.js +++ b/docs/html/search/enumvalues_0.js @@ -9,5 +9,5 @@ var searchData= ['lsqver_5f037',['LSQVER_037',['../lsquic_8h.html#a2633ae9ee8d564f4c499f6eb0913d4dba5c2aa78b22ea462ae839566e19a87ea7',1,'lsquic.h']]], ['lsqver_5f038',['LSQVER_038',['../lsquic_8h.html#a2633ae9ee8d564f4c499f6eb0913d4dba2d39809298e0c7866b21fc7932504966',1,'lsquic.h']]], ['lsqver_5f039',['LSQVER_039',['../lsquic_8h.html#a2633ae9ee8d564f4c499f6eb0913d4dbaa9b8bed8ca169e8a3762308cbf0f3af3',1,'lsquic.h']]], - ['lsqver_5f040',['LSQVER_040',['../lsquic_8h.html#a2633ae9ee8d564f4c499f6eb0913d4dbac17f226a6a4c61377a5e50710d5ef12f',1,'lsquic.h']]] + ['lsqver_5f041',['LSQVER_041',['../lsquic_8h.html#a2633ae9ee8d564f4c499f6eb0913d4dbac673a00564784af03b3b9cb747ed8af3',1,'lsquic.h']]] ]; diff --git a/include/lsquic.h b/include/lsquic.h index 697165a..e889ae7 100644 --- a/include/lsquic.h +++ b/include/lsquic.h @@ -67,9 +67,9 @@ enum lsquic_version LSQVER_039, /** - * Q040. RST_STREAM, ACK and STREAM frames match IETF format. + * Q041. RST_STREAM, ACK and STREAM frames match IETF format. */ - LSQVER_040, + LSQVER_041, N_LSQVER }; @@ -79,9 +79,9 @@ enum lsquic_version * @see lsquic_version */ #define LSQUIC_SUPPORTED_VERSIONS ((1 << LSQVER_035) | (1 << LSQVER_037) | \ - (1 << LSQVER_038) | (1 << LSQVER_039) | (1 << LSQVER_040)) + (1 << LSQVER_038) | (1 << LSQVER_039) | (1 << LSQVER_041)) -#define LSQUIC_EXPERIMENTAL_VERSIONS ((1 << LSQVER_040)) +#define LSQUIC_EXPERIMENTAL_VERSIONS ((1 << LSQVER_041)) /** * @struct lsquic_stream_if diff --git a/src/liblsquic/CMakeLists.txt b/src/liblsquic/CMakeLists.txt index 3b5c88e..56f09e6 100644 --- a/src/liblsquic/CMakeLists.txt +++ b/src/liblsquic/CMakeLists.txt @@ -8,7 +8,7 @@ SET(lsquic_STAT_SRCS lsquic_parse_gquic_common.c lsquic_parse_gquic_le.c lsquic_parse_gquic_be.c - lsquic_parse_gquic_Q040.c + lsquic_parse_gquic_Q041.c lsquic_packet_in.c lsquic_packet_out.c lsquic_crypto.c diff --git a/src/liblsquic/lsquic_engine.c b/src/liblsquic/lsquic_engine.c index a3cbf73..10ceedc 100644 --- a/src/liblsquic/lsquic_engine.c +++ b/src/liblsquic/lsquic_engine.c @@ -20,11 +20,6 @@ #include #include -#ifndef NDEBUG -#include -#include /* For code that loses packets */ -#endif - #include "lsquic.h" diff --git a/src/liblsquic/lsquic_parse.h b/src/liblsquic/lsquic_parse.h index 3361daf..95d4963 100644 --- a/src/liblsquic/lsquic_parse.h +++ b/src/liblsquic/lsquic_parse.h @@ -158,7 +158,7 @@ struct parse_funcs extern const struct parse_funcs lsquic_parse_funcs_gquic_le; /* Q039 and later are big-endian: */ extern const struct parse_funcs lsquic_parse_funcs_gquic_Q039; -extern const struct parse_funcs lsquic_parse_funcs_gquic_Q040; +extern const struct parse_funcs lsquic_parse_funcs_gquic_Q041; #define select_pf_by_ver(ver) ( \ ((1 << (ver)) & ((1 << LSQVER_035) | \ @@ -166,7 +166,7 @@ extern const struct parse_funcs lsquic_parse_funcs_gquic_Q040; ? &lsquic_parse_funcs_gquic_le : \ ((1 << (ver)) & (1 << LSQVER_039)) \ ? &lsquic_parse_funcs_gquic_Q039 \ - : &lsquic_parse_funcs_gquic_Q040) + : &lsquic_parse_funcs_gquic_Q041) /* This function is QUIC-version independent */ int @@ -177,7 +177,7 @@ enum QUIC_FRAME_TYPE parse_frame_type_gquic_Q035_thru_Q039 (unsigned char first_byte); enum QUIC_FRAME_TYPE -parse_frame_type_gquic_Q040 (unsigned char first_byte); +parse_frame_type_gquic_Q041 (unsigned char first_byte); unsigned parse_stream_frame_header_sz_gquic (unsigned char type); diff --git a/src/liblsquic/lsquic_parse_gquic_Q040.c b/src/liblsquic/lsquic_parse_gquic_Q041.c similarity index 98% rename from src/liblsquic/lsquic_parse_gquic_Q040.c rename to src/liblsquic/lsquic_parse_gquic_Q041.c index 428d8fa..09dd6fa 100644 --- a/src/liblsquic/lsquic_parse_gquic_Q040.c +++ b/src/liblsquic/lsquic_parse_gquic_Q041.c @@ -101,12 +101,6 @@ gquic_ietf_parse_stream_frame (const unsigned char *buf, size_t rem_packet_sz, stream_frame->data_frame.df_fin = !!(type & 0x20); - if (data_len) - { - READ_UINT(stream_frame->data_frame.df_size, 16, p, data_len); - p += data_len; - } - READ_UINT(stream_frame->stream_id, 32, p, stream_id_len); p += stream_id_len; @@ -115,6 +109,8 @@ gquic_ietf_parse_stream_frame (const unsigned char *buf, size_t rem_packet_sz, if (data_len) { + READ_UINT(stream_frame->data_frame.df_size, 16, p, data_len); + p += data_len; CHECK_SPACE(stream_frame->data_frame.df_size, p, pend); stream_frame->data_frame.df_data = p; p += stream_frame->data_frame.df_size; @@ -198,8 +194,6 @@ gquic_ietf_gen_stream_frame (unsigned char *buf, size_t buf_len, uint32_t stream CHECK_SPACE(1 + olen + slen + dlen + + 1 /* We need to write at least 1 byte */, buf, buf + buf_len); - p += dlen; /* Save room for data length */ - #if __BYTE_ORDER == __LITTLE_ENDIAN stream_id = bswap_32(stream_id); #endif @@ -213,7 +207,7 @@ gquic_ietf_gen_stream_frame (unsigned char *buf, size_t buf_len, uint32_t stream p += olen; /* Read as much as we can */ - nr = gsf_read(stream, p, n_avail, &fin); + nr = gsf_read(stream, p + dlen, n_avail, &fin); assert(nr != 0); if (dlen) @@ -222,17 +216,15 @@ gquic_ietf_gen_stream_frame (unsigned char *buf, size_t buf_len, uint32_t stream #if __BYTE_ORDER == __LITTLE_ENDIAN nr_copy = bswap_16(nr_copy); #endif - memcpy(p - slen - olen - 2, &nr_copy, 2); + memcpy(p, &nr_copy, 2); } - p += nr; + p += dlen + nr; } else { dlen = 2; CHECK_SPACE(1 + slen + olen + 2, buf, buf + buf_len); - memset(p, 0, 2); - p += 2; #if __BYTE_ORDER == __LITTLE_ENDIAN stream_id = bswap_32(stream_id); #endif @@ -243,6 +235,8 @@ gquic_ietf_gen_stream_frame (unsigned char *buf, size_t buf_len, uint32_t stream #endif memcpy(p, (unsigned char *) &offset + 8 - olen, olen); p += olen; + memset(p, 0, 2); + p += 2; } /* Convert slen to bit representation: 0 - 3: */ @@ -279,7 +273,7 @@ gquic_ietf_parse_ack_high (const unsigned char *buf, size_t buf_len) type = buf[0]; largest_obs_len = twobit_to_1248((type >> 2) & 3); n_blocks_len = !!(type & 0x10); - assert(parse_frame_type_gquic_Q040(type) == QUIC_FRAME_ACK); + assert(parse_frame_type_gquic_Q041(type) == QUIC_FRAME_ACK); assert(buf_len >= 1 + n_blocks_len + 1 + largest_obs_len); READ_UINT(packno, 64, buf + 1 + n_blocks_len + 1, largest_obs_len); return packno; @@ -540,7 +534,7 @@ gquic_ietf_gen_ack_frame (unsigned char *outbuf, size_t outbuf_sz, } -const struct parse_funcs lsquic_parse_funcs_gquic_Q040 = +const struct parse_funcs lsquic_parse_funcs_gquic_Q041 = { .pf_gen_ver_nego_pkt = gquic_be_gen_ver_nego_pkt, .pf_gen_reg_pkt_header = gquic_be_gen_reg_pkt_header, @@ -570,5 +564,5 @@ const struct parse_funcs lsquic_parse_funcs_gquic_Q040 = .pf_write_float_time16 = gquic_be_write_float_time16, .pf_read_float_time16 = gquic_be_read_float_time16, #endif - .pf_parse_frame_type = parse_frame_type_gquic_Q040, + .pf_parse_frame_type = parse_frame_type_gquic_Q041, }; diff --git a/src/liblsquic/lsquic_parse_gquic_common.c b/src/liblsquic/lsquic_parse_gquic_common.c index 342faf5..854d4e7 100644 --- a/src/liblsquic/lsquic_parse_gquic_common.c +++ b/src/liblsquic/lsquic_parse_gquic_common.c @@ -389,7 +389,7 @@ static const enum QUIC_FRAME_TYPE byte2frame_type_Q035_thru_Q039[0x100] = }; -static const enum QUIC_FRAME_TYPE byte2frame_type_Q040[0x100] = +static const enum QUIC_FRAME_TYPE byte2frame_type_Q041[0x100] = { [0x00] = QUIC_FRAME_PADDING, [0x01] = QUIC_FRAME_RST_STREAM, @@ -658,9 +658,9 @@ parse_frame_type_gquic_Q035_thru_Q039 (unsigned char b) enum QUIC_FRAME_TYPE -parse_frame_type_gquic_Q040 (unsigned char b) +parse_frame_type_gquic_Q041 (unsigned char b) { - return byte2frame_type_Q040[b]; + return byte2frame_type_Q041[b]; } diff --git a/src/liblsquic/lsquic_version.c b/src/liblsquic/lsquic_version.c index d9aff6f..1f60dd7 100644 --- a/src/liblsquic/lsquic_version.c +++ b/src/liblsquic/lsquic_version.c @@ -12,7 +12,7 @@ static const unsigned char version_tags[N_LSQVER][4] = [LSQVER_037] = { 'Q', '0', '3', '7', }, [LSQVER_038] = { 'Q', '0', '3', '8', }, [LSQVER_039] = { 'Q', '0', '3', '9', }, - [LSQVER_040] = { 'Q', '0', '4', '0', }, + [LSQVER_041] = { 'Q', '0', '4', '1', }, }; @@ -61,7 +61,7 @@ const char *const lsquic_ver2str[N_LSQVER] = { [LSQVER_037] = "Q037", [LSQVER_038] = "Q038", [LSQVER_039] = "Q039", - [LSQVER_040] = "Q040", + [LSQVER_041] = "Q041", }; diff --git a/test/test_common.c b/test/test_common.c index 388e071..c2974a5 100644 --- a/test/test_common.c +++ b/test/test_common.c @@ -916,9 +916,9 @@ set_engine_option (struct lsquic_engine_settings *settings, settings->es_versions |= 1 << LSQVER_039; return 0; } - if (0 == strcmp(val, "Q040")) + if (0 == strcmp(val, "Q041")) { - settings->es_versions |= 1 << LSQVER_040; + settings->es_versions |= 1 << LSQVER_041; return 0; } } diff --git a/test/unittests/test_ackgen_gquic_ietf.c b/test/unittests/test_ackgen_gquic_ietf.c index 76a5e2d..af63b10 100644 --- a/test/unittests/test_ackgen_gquic_ietf.c +++ b/test/unittests/test_ackgen_gquic_ietf.c @@ -17,7 +17,7 @@ #include "lsquic_logger.h" #include "lsquic.h" -static const struct parse_funcs *const pf = select_pf_by_ver(LSQVER_040); +static const struct parse_funcs *const pf = select_pf_by_ver(LSQVER_041); static void test1 (void) /* Inverse of quic_framer_test.cc -- NewAckFrameOneAckBlock */ diff --git a/test/unittests/test_ackparse_gquic_ietf.c b/test/unittests/test_ackparse_gquic_ietf.c index 1892b41..4492ccc 100644 --- a/test/unittests/test_ackparse_gquic_ietf.c +++ b/test/unittests/test_ackparse_gquic_ietf.c @@ -11,7 +11,7 @@ #include "lsquic_util.h" #include "lsquic.h" -static const struct parse_funcs *const pf = select_pf_by_ver(LSQVER_040); +static const struct parse_funcs *const pf = select_pf_by_ver(LSQVER_041); static lsquic_packno_t diff --git a/test/unittests/test_rst_stream_ietf.c b/test/unittests/test_rst_stream_ietf.c index 43e20be..9bd6f4f 100644 --- a/test/unittests/test_rst_stream_ietf.c +++ b/test/unittests/test_rst_stream_ietf.c @@ -10,7 +10,7 @@ #include "lsquic_alarmset.h" #include "lsquic_parse.h" -static const struct parse_funcs *const pf = select_pf_by_ver(LSQVER_040); +static const struct parse_funcs *const pf = select_pf_by_ver(LSQVER_041); /* The test is both for generation and parsing: */ diff --git a/test/unittests/test_streamgen.c b/test/unittests/test_streamgen.c index ccf845d..4529598 100644 --- a/test/unittests/test_streamgen.c +++ b/test/unittests/test_streamgen.c @@ -506,7 +506,7 @@ static const struct test tests[] = { * IETF: */ { .lineno = __LINE__, - .pf = select_pf_by_ver(LSQVER_040), + .pf = select_pf_by_ver(LSQVER_041), .fin = { 0, 1, }, .offset = 0x0807060504030201UL, .stream_id = 0x210, @@ -517,9 +517,9 @@ static const struct test tests[] = { /* 11 F SS OO D 11FSSOOD */ /* TYPE FIN SLEN OLEN DLEN */ { 0xC0 | 1 << 5 | 1 << 3 | 3 << 1 | 1, - 0x00, 0x0A, /* Data length */ 0x02, 0x10, /* Stream ID */ 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */ + 0x00, 0x0A, /* Data length */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', }, .len = 1 + 2 + 8 + 2 + 10, @@ -527,7 +527,7 @@ static const struct test tests[] = { }, { .lineno = __LINE__, - .pf = select_pf_by_ver(LSQVER_040), + .pf = select_pf_by_ver(LSQVER_041), .fin = { 0, 0, }, .offset = 0x0807060504030201UL, .stream_id = 0x210, @@ -538,9 +538,9 @@ static const struct test tests[] = { /* 11 F SS OO D 11FSSOOD */ /* TYPE FIN SLEN OLEN DLEN */ { 0xC0 | 0 << 5 | 1 << 3 | 3 << 1 | 1, - 0x00, 0x0A, /* Data length */ 0x02, 0x10, /* Stream ID */ 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */ + 0x00, 0x0A, /* Data length */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', }, .len = 1 + 2 + 8 + 2 + 10, @@ -548,7 +548,7 @@ static const struct test tests[] = { }, { .lineno = __LINE__, - .pf = select_pf_by_ver(LSQVER_040), + .pf = select_pf_by_ver(LSQVER_041), .fin = { 1, 0, }, .offset = 0x0807060504030201UL, .stream_id = 0x210, @@ -559,9 +559,9 @@ static const struct test tests[] = { /* 11 F SS OO D 11FSSOOD */ /* TYPE FIN SLEN OLEN DLEN */ { 0xC0 | 1 << 5 | 1 << 3 | 3 << 1 | 1, - 0x00, 0x00, /* Data length */ 0x02, 0x10, /* Stream ID */ 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */ + 0x00, 0x00, /* Data length */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', }, .len = 1 + 2 + 8 + 2, @@ -569,7 +569,7 @@ static const struct test tests[] = { }, { .lineno = __LINE__, - .pf = select_pf_by_ver(LSQVER_040), + .pf = select_pf_by_ver(LSQVER_041), .fin = { 1, 0, }, .offset = 0x0807060504030201UL, .stream_id = 0x21, @@ -580,9 +580,9 @@ static const struct test tests[] = { /* 11 F SS OO D 11FSSOOD */ /* TYPE FIN SLEN OLEN DLEN */ { 0xC0 | 1 << 5 | 0 << 3 | 3 << 1 | 1, - 0x00, 0x00, /* Data length */ 0x21, /* Stream ID */ 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */ + 0x00, 0x00, /* Data length */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', }, .len = 1 + 1 + 8 + 2, @@ -590,7 +590,7 @@ static const struct test tests[] = { }, { .lineno = __LINE__, - .pf = select_pf_by_ver(LSQVER_040), + .pf = select_pf_by_ver(LSQVER_041), .fin = { 0, 0, }, .offset = 0x77, .stream_id = 0x210, @@ -601,9 +601,9 @@ static const struct test tests[] = { /* 11 F SS OO D 11FSSOOD */ /* TYPE FIN SLEN OLEN DLEN */ { 0xC0 | 0 << 5 | 1 << 3 | 1 << 1 | 1, - 0x00, 0x0A, /* Data length */ 0x02, 0x10, /* Stream ID */ 0x00, 0x77, /* Offset */ + 0x00, 0x0A, /* Data length */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', }, .len = 1 + 2 + 2 + 2 + 10, @@ -611,7 +611,7 @@ static const struct test tests[] = { }, { .lineno = __LINE__, - .pf = select_pf_by_ver(LSQVER_040), + .pf = select_pf_by_ver(LSQVER_041), .fin = { 0, 0, }, .offset = 0x0, .stream_id = 0x210, @@ -622,9 +622,9 @@ static const struct test tests[] = { /* 11 F SS OO D 11FSSOOD */ /* TYPE FIN SLEN OLEN DLEN */ { 0xC0 | 0 << 5 | 1 << 3 | 0 << 1 | 1, - 0x00, 0x0A, /* Data length */ 0x02, 0x10, /* Stream ID */ /* Offset */ + 0x00, 0x0A, /* Data length */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', }, .len = 1 + 2 + 0 + 2 + 10, @@ -632,7 +632,7 @@ static const struct test tests[] = { }, { .lineno = __LINE__, - .pf = select_pf_by_ver(LSQVER_040), + .pf = select_pf_by_ver(LSQVER_041), .fin = { 0, 1, }, .offset = 0x0, .stream_id = 0x210, @@ -643,9 +643,9 @@ static const struct test tests[] = { /* 11 F SS OO D 11FSSOOD */ /* TYPE FIN SLEN OLEN DLEN */ { 0xC0 | 1 << 5 | 1 << 3 | 0 << 1 | 1, - 0x00, 0x01, /* Data length */ 0x02, 0x10, /* Stream ID */ /* Offset */ + 0x00, 0x01, /* Data length */ '0', }, .len = 1 + 2 + 0 + 2 + 1, @@ -653,7 +653,7 @@ static const struct test tests[] = { }, { .lineno = __LINE__, - .pf = select_pf_by_ver(LSQVER_040), + .pf = select_pf_by_ver(LSQVER_041), .fin = { 0, 0, }, .offset = 0xFFFFFF, .stream_id = 0x210, @@ -664,9 +664,9 @@ static const struct test tests[] = { /* 11 F SS OO D 11FSSOOD */ /* TYPE FIN SLEN OLEN DLEN */ { 0xC0 | 0 << 5 | 1 << 3 | 2 << 1 | 1, - 0x00, 0x0A, /* Data length */ 0x02, 0x10, /* Stream ID */ 0x00, 0xFF, 0xFF, 0xFF, /* Offset */ + 0x00, 0x0A, /* Data length */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', }, .len = 1 + 2 + 4 + 2 + 10, @@ -674,7 +674,7 @@ static const struct test tests[] = { }, { .lineno = __LINE__, - .pf = select_pf_by_ver(LSQVER_040), + .pf = select_pf_by_ver(LSQVER_041), .fin = { 0, 0, }, .offset = 0xFFFFFFFFULL + 1, .stream_id = 0x210, @@ -685,9 +685,9 @@ static const struct test tests[] = { /* 11 F SS OO D 11FSSOOD */ /* TYPE FIN SLEN OLEN DLEN */ { 0xC0 | 0 << 5 | 1 << 3 | 3 << 1 | 1, - 0x00, 0x0A, /* Data length */ 0x02, 0x10, /* Stream ID */ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, /* Offset */ + 0x00, 0x0A, /* Data length */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', }, .len = 1 + 2 + 8 + 2 + 10, @@ -695,7 +695,7 @@ static const struct test tests[] = { }, { .lineno = __LINE__, - .pf = select_pf_by_ver(LSQVER_040), + .pf = select_pf_by_ver(LSQVER_041), .fin = { 0, 0, }, .offset = 0xFFFFFFFFULL + 1, .stream_id = 0x210, @@ -715,7 +715,7 @@ static const struct test tests[] = { }, { .lineno = __LINE__, - .pf = select_pf_by_ver(LSQVER_040), + .pf = select_pf_by_ver(LSQVER_041), .fin = { 1, 0, }, .offset = 0xB4, .stream_id = 0x01, @@ -726,9 +726,9 @@ static const struct test tests[] = { /* 11 F SS OO D 11FSSOOD */ /* TYPE FIN SLEN OLEN DLEN */ { 0xC0 | 1 << 5 | 0 << 3 | 1 << 1 | 1, - 0x00, 0x00, /* Data length */ 0x01, /* Stream ID */ 0x00, 0xB4, /* Offset */ + 0x00, 0x00, /* Data length */ }, .len = 6, .min_sz = 6, diff --git a/test/unittests/test_streamparse.c b/test/unittests/test_streamparse.c index 66be2f4..45bcb6f 100644 --- a/test/unittests/test_streamparse.c +++ b/test/unittests/test_streamparse.c @@ -444,13 +444,13 @@ static const struct test tests[] = { */ { "Balls to the wall: every possible bit is set", __LINE__, - select_pf_by_ver(LSQVER_040), + select_pf_by_ver(LSQVER_041), /* 11 F SS OO D 11FSSOOD */ /* TYPE FIN SLEN OLEN DLEN */ { 0xC0 | 1 << 5 | 3 << 3 | 3 << 1 | 1, - 0x01, 0xC4, /* Data length */ 0x00, 0x00, 0x02, 0x10, /* Stream ID */ 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */ + 0x01, 0xC4, /* Data length */ }, 1 + 4 + 8 + 2, 0x200, @@ -464,13 +464,13 @@ static const struct test tests[] = { { "Balls to the wall #2: every possible bit is set, except FIN", __LINE__, - select_pf_by_ver(LSQVER_040), + select_pf_by_ver(LSQVER_041), /* 11 F SS OO D 11FSSOOD */ /* TYPE FIN SLEN OLEN DLEN */ { 0xC0 | 0 << 5 | 3 << 3 | 3 << 1 | 1, - 0x01, 0xC4, /* Data length */ 0x00, 0x00, 0x02, 0x10, /* Stream ID */ 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */ + 0x01, 0xC4, /* Data length */ }, 1 + 4 + 8 + 2, 0x200, @@ -484,12 +484,13 @@ static const struct test tests[] = { { "Data length is zero", __LINE__, - select_pf_by_ver(LSQVER_040), + select_pf_by_ver(LSQVER_041), /* 11 F SS OO D 11FSSOOD */ /* TYPE FIN SLEN OLEN DLEN */ { 0xC0 | 1 << 5 | 3 << 3 | 3 << 1 | 0, 0x00, 0x00, 0x02, 0x10, /* Stream ID */ 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */ + 0xC4, 0x01, /* Data length: note this does not matter */ }, 1 + 4 + 8 + 0, 0x200, @@ -503,13 +504,13 @@ static const struct test tests[] = { { "Stream ID length is 1", __LINE__, - select_pf_by_ver(LSQVER_040), + select_pf_by_ver(LSQVER_041), /* 11 F SS OO D 11FSSOOD */ /* TYPE FIN SLEN OLEN DLEN */ { 0xC0 | 1 << 5 | 0 << 3 | 3 << 1 | 1, - 0x01, 0xC4, /* Data length */ 0xF0, /* Stream ID */ 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* Offset */ + 0x01, 0xC4, /* Data length */ }, 1 + 1 + 8 + 2, 0x200, @@ -523,12 +524,13 @@ static const struct test tests[] = { { "All bits are zero save offset length", __LINE__, - select_pf_by_ver(LSQVER_040), + select_pf_by_ver(LSQVER_041), /* 11 F SS OO D 11FSSOOD */ /* TYPE FIN SLEN OLEN DLEN */ { 0xC0 | 0 << 5 | 0 << 3 | 1 << 1 | 0, 0xF0, /* Stream ID */ 0x02, 0x55, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, /* Offset */ + 0xC4, 0x01, /* Data length */ }, 1 + 1 + 2 + 0, 0x200, @@ -542,7 +544,7 @@ static const struct test tests[] = { { "Sanity check: either FIN must be set or data length is not zero #1", __LINE__, - select_pf_by_ver(LSQVER_040), + select_pf_by_ver(LSQVER_041), /* 11 F SS OO D 11FSSOOD */ /* TYPE FIN SLEN OLEN DLEN */ { 0xC0 | 0 << 5 | 0 << 3 | 1 << 1 | 0, @@ -564,13 +566,13 @@ static const struct test tests[] = { { "Sanity check: either FIN must be set or data length is not zero #2", __LINE__, - select_pf_by_ver(LSQVER_040), + select_pf_by_ver(LSQVER_041), /* 11 F SS OO D 11FSSOOD */ /* TYPE FIN SLEN OLEN DLEN */ { 0xC0 | 0 << 5 | 0 << 3 | 1 << 1 | 1, - 0x00, 0x00, 0xF0, /* Stream ID */ 0x02, 0x55, /* Offset */ + 0x00, 0x00, }, 1 + 1 + 2 + 2, 200, @@ -584,13 +586,13 @@ static const struct test tests[] = { { "Sanity check: either FIN must be set or data length is not zero #3", __LINE__, - select_pf_by_ver(LSQVER_040), + select_pf_by_ver(LSQVER_041), /* 11 F SS OO D 11FSSOOD */ /* TYPE FIN SLEN OLEN DLEN */ { 0xC0 | 1 << 5 | 0 << 3 | 1 << 1 | 1, - 0x00, 0x00, 0xF0, /* Stream ID */ 0x02, 0x55, /* Offset */ + 0x00, 0x00, }, 1 + 1 + 2 + 2, 200, @@ -604,13 +606,13 @@ static const struct test tests[] = { { "Check data bounds #1", __LINE__, - select_pf_by_ver(LSQVER_040), + select_pf_by_ver(LSQVER_041), /* 11 F SS OO D 11FSSOOD */ /* TYPE FIN SLEN OLEN DLEN */ { 0xC0 | 0 << 5 | 0 << 3 | 1 << 1 | 1, - 0x01, 0xFA, /* Data length */ 0xF0, /* Stream ID */ 0x02, 0x55, /* Offset */ + 0x01, 0xFA, /* Data length */ }, 1 + 1 + 2 + 2, 0x200, @@ -624,13 +626,13 @@ static const struct test tests[] = { { "Check data bounds #2", __LINE__, - select_pf_by_ver(LSQVER_040), + select_pf_by_ver(LSQVER_041), /* 11 F SS OO D 11FSSOOD */ /* TYPE FIN SLEN OLEN DLEN */ { 0xC0 | 0 << 5 | 0 << 3 | 1 << 1 | 1, - 0x01, 0xFB, /* <--- One byte too many */ 0xF0, /* Stream ID */ 0x02, 0x55, /* Offset */ + 0x01, 0xFB, /* <--- One byte too many */ }, 1 + 1 + 2 + 2, 0x200,