VLC  4.0.0-dev
h2frame.c File Reference
Include dependency graph for h2frame.c:

Data Structures

struct  vlc_h2_parser
 HTTP/2 incoming frames parser. More...
 

Macros

#define vlc_h2_frame_payload(f)   ((f)->data + 9)
 

Typedefs

typedef int(* vlc_h2_parser) (struct vlc_h2_parser *, struct vlc_h2_frame *, size_t, uint_fast32_t)
 

Enumerations

enum  {
  VLC_H2_FRAME_DATA , VLC_H2_FRAME_HEADERS , VLC_H2_FRAME_PRIORITY , VLC_H2_FRAME_RST_STREAM ,
  VLC_H2_FRAME_SETTINGS , VLC_H2_FRAME_PUSH_PROMISE , VLC_H2_FRAME_PING , VLC_H2_FRAME_GOAWAY ,
  VLC_H2_FRAME_WINDOW_UPDATE , VLC_H2_FRAME_CONTINUATION
}
 
enum  { VLC_H2_DATA_END_STREAM = 0x01 , VLC_H2_DATA_PADDED = 0x08 }
 
enum  { VLC_H2_HEADERS_END_STREAM = 0x01 , VLC_H2_HEADERS_END_HEADERS = 0x04 , VLC_H2_HEADERS_PADDED = 0x08 , VLC_H2_HEADERS_PRIORITY = 0x20 }
 
enum  { VLC_H2_SETTINGS_ACK = 0x01 }
 
enum  { VLC_H2_PUSH_PROMISE_END_HEADERS = 0x04 , VLC_H2_PUSH_PROMISE_PADDED = 0x08 }
 
enum  { VLC_H2_PING_ACK = 0x01 }
 
enum  { VLC_H2_CONTINUATION_END_HEADERS = 0x04 }
 

Functions

static struct vlc_h2_framevlc_h2_frame_alloc (uint_fast8_t type, uint_fast8_t flags, uint_fast32_t stream_id, size_t length)
 
static uint_fast32_t vlc_h2_frame_length (const struct vlc_h2_frame *f)
 
size_t vlc_h2_frame_size (const struct vlc_h2_frame *f)
 
static uint_fast8_t vlc_h2_frame_type (const struct vlc_h2_frame *f)
 
static uint_fast8_t vlc_h2_frame_flags (const struct vlc_h2_frame *f)
 
static uint_fast32_t vlc_h2_frame_id (const struct vlc_h2_frame *f)
 
static const char * vlc_h2_type_name (uint_fast8_t type)
 
struct vlc_h2_framevlc_h2_frame_headers (uint_fast32_t stream_id, uint_fast32_t mtu, bool eos, unsigned count, const char *const headers[][2])
 
struct vlc_h2_framevlc_h2_frame_data (uint_fast32_t stream_id, const void *buf, size_t len, bool eos)
 
struct vlc_h2_framevlc_h2_frame_rst_stream (uint_fast32_t stream_id, uint_fast32_t error_code)
 
struct vlc_h2_framevlc_h2_frame_settings (void)
 
struct vlc_h2_framevlc_h2_frame_settings_ack (void)
 
const char * vlc_h2_setting_name (uint_fast16_t id)
 
struct vlc_h2_framevlc_h2_frame_ping (uint64_t opaque)
 
struct vlc_h2_framevlc_h2_frame_pong (uint64_t opaque)
 
struct vlc_h2_framevlc_h2_frame_goaway (uint_fast32_t last_stream_id, uint_fast32_t error_code)
 
struct vlc_h2_framevlc_h2_frame_window_update (uint_fast32_t stream_id, uint_fast32_t credit)
 
const char * vlc_h2_strerror (uint_fast32_t code)
 
void vlc_h2_frame_dump (void *opaque, const struct vlc_h2_frame *f, const char *msg)
 
const uint8_t *() vlc_h2_frame_data_get (const struct vlc_h2_frame *f, size_t *restrict lenp)
 
static int vlc_h2_parse_generic (struct vlc_h2_parser *p, struct vlc_h2_frame *f, size_t len, uint_fast32_t id)
 Parses any HTTP/2 frame. More...
 
static int vlc_h2_parse_headers_block (struct vlc_h2_parser *, struct vlc_h2_frame *, size_t, uint_fast32_t)
 
static int vlc_h2_parse_error (struct vlc_h2_parser *p, uint_fast32_t code)
 
static int vlc_h2_stream_error (struct vlc_h2_parser *p, uint_fast32_t id, uint_fast32_t code)
 
static void * vlc_h2_stream_lookup (struct vlc_h2_parser *p, uint_fast32_t id)
 
static void vlc_h2_parse_headers_start (struct vlc_h2_parser *p, uint_fast32_t sid, bool eos)
 
static int vlc_h2_parse_headers_append (struct vlc_h2_parser *p, const uint8_t *data, size_t len)
 
static int vlc_h2_parse_headers_end (struct vlc_h2_parser *p)
 
static int vlc_h2_parse_frame_data (struct vlc_h2_parser *p, struct vlc_h2_frame *f, size_t len, uint_fast32_t id)
 Parses an HTTP/2 DATA frame. More...
 
static int vlc_h2_parse_frame_headers (struct vlc_h2_parser *p, struct vlc_h2_frame *f, size_t len, uint_fast32_t id)
 Parses an HTTP/2 HEADERS frame. More...
 
static int vlc_h2_parse_frame_priority (struct vlc_h2_parser *p, struct vlc_h2_frame *f, size_t len, uint_fast32_t id)
 Parses an HTTP/2 PRIORITY frame. More...
 
static int vlc_h2_parse_frame_rst_stream (struct vlc_h2_parser *p, struct vlc_h2_frame *f, size_t len, uint_fast32_t id)
 Parses an HTTP/2 RST_STREAM frame. More...
 
static int vlc_h2_parse_frame_settings (struct vlc_h2_parser *p, struct vlc_h2_frame *f, size_t len, uint_fast32_t id)
 Parses an HTTP/2 SETTINGS frame. More...
 
static int vlc_h2_parse_frame_push_promise (struct vlc_h2_parser *p, struct vlc_h2_frame *f, size_t len, uint_fast32_t id)
 Parses an HTTP/2 PUSH_PROMISE frame. More...
 
static int vlc_h2_parse_frame_ping (struct vlc_h2_parser *p, struct vlc_h2_frame *f, size_t len, uint_fast32_t id)
 Parses an HTTP/2 PING frame. More...
 
static int vlc_h2_parse_frame_goaway (struct vlc_h2_parser *p, struct vlc_h2_frame *f, size_t len, uint_fast32_t id)
 Parses an HTTP/2 GOAWAY frame. More...
 
static int vlc_h2_parse_frame_window_update (struct vlc_h2_parser *p, struct vlc_h2_frame *f, size_t len, uint_fast32_t id)
 Parses an HTTP/2 WINDOW_UPDATE frame. More...
 
static int vlc_h2_parse_frame_continuation (struct vlc_h2_parser *p, struct vlc_h2_frame *f, size_t len, uint_fast32_t id)
 Parses an HTTP/2 CONTINUATION frame. More...
 
static int vlc_h2_parse_frame_unknown (struct vlc_h2_parser *p, struct vlc_h2_frame *f, size_t len, uint_fast32_t id)
 Parses an HTTP/2 frame of unknown type. More...
 
static int vlc_h2_parse_preface (struct vlc_h2_parser *p, struct vlc_h2_frame *f, size_t len, uint_fast32_t id)
 Parses the HTTP/2 connection preface. More...
 
static int vlc_h2_parse_failed (struct vlc_h2_parser *p, struct vlc_h2_frame *f, size_t len, uint_fast32_t id)
 
int vlc_h2_parse (struct vlc_h2_parser *p, struct vlc_h2_frame *f)
 
struct vlc_h2_parservlc_h2_parse_init (void *ctx, const struct vlc_h2_parser_cbs *cbs)
 
void vlc_h2_parse_destroy (struct vlc_h2_parser *p)
 

Variables

static const vlc_h2_parser vlc_h2_parsers []
 

Macro Definition Documentation

◆ vlc_h2_frame_payload

#define vlc_h2_frame_payload (   f)    ((f)->data + 9)

Typedef Documentation

◆ vlc_h2_parser

typedef int(* vlc_h2_parser) (struct vlc_h2_parser *, struct vlc_h2_frame *, size_t, uint_fast32_t)

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
VLC_H2_FRAME_DATA 
VLC_H2_FRAME_HEADERS 
VLC_H2_FRAME_PRIORITY 
VLC_H2_FRAME_RST_STREAM 
VLC_H2_FRAME_SETTINGS 
VLC_H2_FRAME_PUSH_PROMISE 
VLC_H2_FRAME_PING 
VLC_H2_FRAME_GOAWAY 
VLC_H2_FRAME_WINDOW_UPDATE 
VLC_H2_FRAME_CONTINUATION 

◆ anonymous enum

anonymous enum
Enumerator
VLC_H2_DATA_END_STREAM 
VLC_H2_DATA_PADDED 

◆ anonymous enum

anonymous enum
Enumerator
VLC_H2_HEADERS_END_STREAM 
VLC_H2_HEADERS_END_HEADERS 
VLC_H2_HEADERS_PADDED 
VLC_H2_HEADERS_PRIORITY 

◆ anonymous enum

anonymous enum
Enumerator
VLC_H2_SETTINGS_ACK 

◆ anonymous enum

anonymous enum
Enumerator
VLC_H2_PUSH_PROMISE_END_HEADERS 
VLC_H2_PUSH_PROMISE_PADDED 

◆ anonymous enum

anonymous enum
Enumerator
VLC_H2_PING_ACK 

◆ anonymous enum

anonymous enum
Enumerator
VLC_H2_CONTINUATION_END_HEADERS 

Function Documentation

◆ vlc_h2_frame_alloc()

static struct vlc_h2_frame* vlc_h2_frame_alloc ( uint_fast8_t  type,
uint_fast8_t  flags,
uint_fast32_t  stream_id,
size_t  length 
)
static

◆ vlc_h2_frame_flags()

◆ vlc_h2_frame_id()

static uint_fast32_t vlc_h2_frame_id ( const struct vlc_h2_frame f)
static

References vlc_h2_frame::data, and GetDWBE.

Referenced by vlc_h2_frame_dump(), and vlc_h2_parse().

◆ vlc_h2_frame_length()

static uint_fast32_t vlc_h2_frame_length ( const struct vlc_h2_frame f)
static

◆ vlc_h2_frame_type()

static uint_fast8_t vlc_h2_frame_type ( const struct vlc_h2_frame f)
static

◆ vlc_h2_parse_error()

◆ vlc_h2_parse_failed()

static int vlc_h2_parse_failed ( struct vlc_h2_parser p,
struct vlc_h2_frame f,
size_t  len,
uint_fast32_t  id 
)
static

References p.

Referenced by vlc_h2_parse().

◆ vlc_h2_parse_frame_continuation()

static int vlc_h2_parse_frame_continuation ( struct vlc_h2_parser p,
struct vlc_h2_frame f,
size_t  len,
uint_fast32_t  id 
)
static

◆ vlc_h2_parse_frame_data()

◆ vlc_h2_parse_frame_goaway()

static int vlc_h2_parse_frame_goaway ( struct vlc_h2_parser p,
struct vlc_h2_frame f,
size_t  len,
uint_fast32_t  id 
)
static

◆ vlc_h2_parse_frame_headers()

◆ vlc_h2_parse_frame_ping()

static int vlc_h2_parse_frame_ping ( struct vlc_h2_parser p,
struct vlc_h2_frame f,
size_t  len,
uint_fast32_t  id 
)
static

◆ vlc_h2_parse_frame_priority()

static int vlc_h2_parse_frame_priority ( struct vlc_h2_parser p,
struct vlc_h2_frame f,
size_t  len,
uint_fast32_t  id 
)
static

Parses an HTTP/2 PRIORITY frame.

References p, VLC_H2_FRAME_SIZE_ERROR, vlc_h2_parse_error(), VLC_H2_PROTOCOL_ERROR, and vlc_h2_stream_error().

◆ vlc_h2_parse_frame_push_promise()

static int vlc_h2_parse_frame_push_promise ( struct vlc_h2_parser p,
struct vlc_h2_frame f,
size_t  len,
uint_fast32_t  id 
)
static

◆ vlc_h2_parse_frame_rst_stream()

static int vlc_h2_parse_frame_rst_stream ( struct vlc_h2_parser p,
struct vlc_h2_frame f,
size_t  len,
uint_fast32_t  id 
)
static

◆ vlc_h2_parse_frame_settings()

static int vlc_h2_parse_frame_settings ( struct vlc_h2_parser p,
struct vlc_h2_frame f,
size_t  len,
uint_fast32_t  id 
)
static

◆ vlc_h2_parse_frame_unknown()

static int vlc_h2_parse_frame_unknown ( struct vlc_h2_parser p,
struct vlc_h2_frame f,
size_t  len,
uint_fast32_t  id 
)
static

Parses an HTTP/2 frame of unknown type.

References p, VLC_H2_FRAME_SIZE_ERROR, VLC_H2_MAX_FRAME, vlc_h2_parse_error(), and vlc_h2_stream_error().

Referenced by vlc_h2_parse_generic().

◆ vlc_h2_parse_frame_window_update()

static int vlc_h2_parse_frame_window_update ( struct vlc_h2_parser p,
struct vlc_h2_frame f,
size_t  len,
uint_fast32_t  id 
)
static

◆ vlc_h2_parse_generic()

static int vlc_h2_parse_generic ( struct vlc_h2_parser p,
struct vlc_h2_frame f,
size_t  len,
uint_fast32_t  id 
)
static

◆ vlc_h2_parse_headers_append()

static int vlc_h2_parse_headers_append ( struct vlc_h2_parser p,
const uint8_t *  data,
size_t  len 
)
static

◆ vlc_h2_parse_headers_block()

static int vlc_h2_parse_headers_block ( struct vlc_h2_parser p,
struct vlc_h2_frame f,
size_t  len,
uint_fast32_t  id 
)
static

◆ vlc_h2_parse_headers_end()

◆ vlc_h2_parse_headers_start()

static void vlc_h2_parse_headers_start ( struct vlc_h2_parser p,
uint_fast32_t  sid,
bool  eos 
)
static

◆ vlc_h2_parse_preface()

static int vlc_h2_parse_preface ( struct vlc_h2_parser p,
struct vlc_h2_frame f,
size_t  len,
uint_fast32_t  id 
)
static

◆ vlc_h2_stream_error()

static int vlc_h2_stream_error ( struct vlc_h2_parser p,
uint_fast32_t  id,
uint_fast32_t  code 
)
static

◆ vlc_h2_stream_lookup()

static void* vlc_h2_stream_lookup ( struct vlc_h2_parser p,
uint_fast32_t  id 
)
static

◆ vlc_h2_type_name()

Variable Documentation

◆ vlc_h2_parsers

const vlc_h2_parser vlc_h2_parsers[]
static
Initial value:
= {
}
static int vlc_h2_parse_frame_continuation(struct vlc_h2_parser *p, struct vlc_h2_frame *f, size_t len, uint_fast32_t id)
Parses an HTTP/2 CONTINUATION frame.
Definition: h2frame.c:888
static int vlc_h2_parse_frame_settings(struct vlc_h2_parser *p, struct vlc_h2_frame *f, size_t len, uint_fast32_t id)
Parses an HTTP/2 SETTINGS frame.
Definition: h2frame.c:723
static int vlc_h2_parse_frame_push_promise(struct vlc_h2_parser *p, struct vlc_h2_frame *f, size_t len, uint_fast32_t id)
Parses an HTTP/2 PUSH_PROMISE frame.
Definition: h2frame.c:758
static int vlc_h2_parse_frame_headers(struct vlc_h2_parser *p, struct vlc_h2_frame *f, size_t len, uint_fast32_t id)
Parses an HTTP/2 HEADERS frame.
Definition: h2frame.c:626
static int vlc_h2_parse_frame_data(struct vlc_h2_parser *p, struct vlc_h2_frame *f, size_t len, uint_fast32_t id)
Parses an HTTP/2 DATA frame.
Definition: h2frame.c:572
static int vlc_h2_parse_frame_priority(struct vlc_h2_parser *p, struct vlc_h2_frame *f, size_t len, uint_fast32_t id)
Parses an HTTP/2 PRIORITY frame.
Definition: h2frame.c:679
static int vlc_h2_parse_frame_goaway(struct vlc_h2_parser *p, struct vlc_h2_frame *f, size_t len, uint_fast32_t id)
Parses an HTTP/2 GOAWAY frame.
Definition: h2frame.c:825
static int vlc_h2_parse_frame_window_update(struct vlc_h2_parser *p, struct vlc_h2_frame *f, size_t len, uint_fast32_t id)
Parses an HTTP/2 WINDOW_UPDATE frame.
Definition: h2frame.c:851
@ VLC_H2_FRAME_HEADERS
Definition: h2frame.c:94
@ VLC_H2_FRAME_PING
Definition: h2frame.c:99
@ VLC_H2_FRAME_DATA
Definition: h2frame.c:93
@ VLC_H2_FRAME_RST_STREAM
Definition: h2frame.c:96
@ VLC_H2_FRAME_PUSH_PROMISE
Definition: h2frame.c:98
@ VLC_H2_FRAME_CONTINUATION
Definition: h2frame.c:102
@ VLC_H2_FRAME_PRIORITY
Definition: h2frame.c:95
@ VLC_H2_FRAME_GOAWAY
Definition: h2frame.c:100
@ VLC_H2_FRAME_WINDOW_UPDATE
Definition: h2frame.c:101
@ VLC_H2_FRAME_SETTINGS
Definition: h2frame.c:97
static int vlc_h2_parse_frame_rst_stream(struct vlc_h2_parser *p, struct vlc_h2_frame *f, size_t len, uint_fast32_t id)
Parses an HTTP/2 RST_STREAM frame.
Definition: h2frame.c:696
static int vlc_h2_parse_frame_ping(struct vlc_h2_parser *p, struct vlc_h2_frame *f, size_t len, uint_fast32_t id)
Parses an HTTP/2 PING frame.
Definition: h2frame.c:794

Referenced by vlc_h2_parse_generic().