Skip to content

Define varint identifiers as macros #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 17 additions & 19 deletions lib/nghttp3_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,23 @@

#include "nghttp3_buf.h"

typedef enum nghttp3_frame_type {
NGHTTP3_FRAME_DATA = 0x00,
NGHTTP3_FRAME_HEADERS = 0x01,
NGHTTP3_FRAME_CANCEL_PUSH = 0x03,
NGHTTP3_FRAME_SETTINGS = 0x04,
NGHTTP3_FRAME_PUSH_PROMISE = 0x05,
NGHTTP3_FRAME_GOAWAY = 0x07,
NGHTTP3_FRAME_MAX_PUSH_ID = 0x0d,
/* PRIORITY_UPDATE: https://datatracker.ietf.org/doc/html/rfc9218 */
NGHTTP3_FRAME_PRIORITY_UPDATE = 0x0f0700,
NGHTTP3_FRAME_PRIORITY_UPDATE_PUSH_ID = 0x0f0701,
} nghttp3_frame_type;

typedef enum nghttp3_h2_reserved_type {
NGHTTP3_H2_FRAME_PRIORITY = 0x02,
NGHTTP3_H2_FRAME_PING = 0x06,
NGHTTP3_H2_FRAME_WINDOW_UPDATE = 0x08,
NGHTTP3_H2_FRAME_CONTINUATION = 0x9,
} nghttp3_h2_reserved_type;
#define NGHTTP3_FRAME_DATA 0x00
#define NGHTTP3_FRAME_HEADERS 0x01
#define NGHTTP3_FRAME_CANCEL_PUSH 0x03
#define NGHTTP3_FRAME_SETTINGS 0x04
#define NGHTTP3_FRAME_PUSH_PROMISE 0x05
#define NGHTTP3_FRAME_GOAWAY 0x07
#define NGHTTP3_FRAME_MAX_PUSH_ID 0x0d
/* PRIORITY_UPDATE: https://datatracker.ietf.org/doc/html/rfc9218 */
#define NGHTTP3_FRAME_PRIORITY_UPDATE 0x0f0700
#define NGHTTP3_FRAME_PRIORITY_UPDATE_PUSH_ID 0x0f0701

/* Frame types that are reserved for HTTP/2, and must not be used in
HTTP/3. */
#define NGHTTP3_H2_FRAME_PRIORITY 0x02
#define NGHTTP3_H2_FRAME_PING 0x06
#define NGHTTP3_H2_FRAME_WINDOW_UPDATE 0x08
#define NGHTTP3_H2_FRAME_CONTINUATION 0x9

typedef struct nghttp3_frame_hd {
int64_t type;
Expand Down
14 changes: 7 additions & 7 deletions lib/nghttp3_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@
#define NGHTTP3_STREAM_MIN_WRITELEN 800

/* nghttp3_stream_type is unidirectional stream type. */
typedef enum nghttp3_stream_type {
NGHTTP3_STREAM_TYPE_CONTROL = 0x00,
NGHTTP3_STREAM_TYPE_PUSH = 0x01,
NGHTTP3_STREAM_TYPE_QPACK_ENCODER = 0x02,
NGHTTP3_STREAM_TYPE_QPACK_DECODER = 0x03,
NGHTTP3_STREAM_TYPE_UNKNOWN = UINT64_MAX,
} nghttp3_stream_type;
typedef uint64_t nghttp3_stream_type;

#define NGHTTP3_STREAM_TYPE_CONTROL 0x00
#define NGHTTP3_STREAM_TYPE_PUSH 0x01
#define NGHTTP3_STREAM_TYPE_QPACK_ENCODER 0x02
#define NGHTTP3_STREAM_TYPE_QPACK_DECODER 0x03
#define NGHTTP3_STREAM_TYPE_UNKNOWN UINT64_MAX

typedef enum nghttp3_ctrl_stream_state {
NGHTTP3_CTRL_STREAM_STATE_FRAME_TYPE,
Expand Down