frame.h for the core 'frames' thingy
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
// frame.h
|
||||
// Defines "frames", the unit of content inside a packet.
|
||||
// Frames know nothing about transport - QUIC and raw modes only differ in packet headers, not the contents.
|
||||
// Note: Pointers in a parsed frame borrow from the packet buffer.
|
||||
|
||||
#ifndef BRAVAIS_FRAME_H
|
||||
#define BRAVAIS_FRAME_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef enum {
|
||||
BRAVAIS_FRAME_TYPE_PADDING = 0x00,
|
||||
BRAVAIS_FRAME_TYPE_CRYPTO = 0x06, // QUIC crypto frame
|
||||
BRAVAIS_FRAME_TYPE_DATAGRAM = 0x31, // QUIC datagram frame
|
||||
} bravais_frame_type_t;
|
||||
|
||||
// Handshake bytes at a byte offset in the handshake stream. Offset + Length makes the fragmentation across datagrams to happen naturally.
|
||||
typedef struct {
|
||||
uint64_t offset;
|
||||
const uint8_t* data;
|
||||
size_t dataLen;
|
||||
} bravais_crypto_frame_t;
|
||||
|
||||
// One tunneled IP packet
|
||||
typedef struct {
|
||||
const uint8_t* data;
|
||||
size_t dataLen;
|
||||
} bravais_datagram_frame_t;
|
||||
|
||||
typedef struct {
|
||||
bravais_frame_type_t type;
|
||||
union {
|
||||
size_t paddingLen; // For PADDING frames, the length of the padding, a consequtive run of PAdDING bytes (parsed as a single frame)
|
||||
bravais_crypto_frame_t crypto;
|
||||
bravais_datagram_frame_t datagram;
|
||||
};
|
||||
} bravais_frame_t;
|
||||
|
||||
// TODO: Functions or something
|
||||
|
||||
#endif // BRAVAIS_FRAME_H
|
||||
Reference in New Issue
Block a user