KEEL 1.0.0
Minimal C11 HTTP client/server library built on epoll/kqueue/io_uring/poll
Loading...
Searching...
No Matches
body_reader.h
Go to the documentation of this file.
1#ifndef KEEL_BODY_READER_H
2#define KEEL_BODY_READER_H
3
4#include <keel/allocator.h>
5#include <stddef.h>
6
8typedef struct KlRequest KlRequest;
9
20
22 int (*on_data)(KlBodyReader *self, const char *data, size_t len);
23 void (*on_complete)(KlBodyReader *self);
24 void (*on_error)(KlBodyReader *self);
25 void (*destroy)(KlBodyReader *self);
26};
27
34typedef KlBodyReader *(*KlBodyReaderFactory)(KlAllocator *alloc,
35 const KlRequest *req,
36 void *user_data);
37
45typedef struct {
48 char *data;
49 size_t len;
50 size_t cap;
51 size_t max_size;
53
66 void *user_data);
67
68#endif
KlBodyReader * kl_body_reader_buffer(KlAllocator *alloc, const KlRequest *req, void *user_data)
Factory: create a buffer body reader.
Bring-your-own allocator vtable.
Definition allocator.h:12
Definition body_reader.h:21
int(* on_data)(KlBodyReader *self, const char *data, size_t len)
Definition body_reader.h:22
void(* on_error)(KlBodyReader *self)
Definition body_reader.h:24
void(* destroy)(KlBodyReader *self)
Definition body_reader.h:25
void(* on_complete)(KlBodyReader *self)
Definition body_reader.h:23
Built-in buffer reader — accumulates body into a growable buffer.
Definition body_reader.h:45
char * data
Definition body_reader.h:48
KlBodyReader base
Definition body_reader.h:46
KlAllocator * alloc
Definition body_reader.h:47
size_t max_size
Definition body_reader.h:51
size_t len
Definition body_reader.h:49
size_t cap
Definition body_reader.h:50
Definition request.h:26