maph 1.0.0 High-Performance Memory-Mapped Key-Value Database with O(1) Lookups

Loading...
Searching...
No Matches
quic.h
Go to the documentation of this file.
1#ifdef LIBUS_USE_QUIC
2
3#ifndef LIBUS_QUIC_H
4#define LIBUS_QUIC_H
5
6/* Experimental QUIC functions */
7
8#include "libusockets.h"
9
10 typedef struct {
11 const char *cert_file_name;
12 const char *key_file_name;
13 const char *passphrase;
14} us_quic_socket_context_options_t;
15
16
17 typedef struct {
18 /* Refers to either the shared listen socket or the client UDP socket */
19 void *udp_socket;
20} us_quic_socket_t;
21
22 struct us_quic_socket_context_s;
23 struct us_quic_listen_socket_s;
24 struct us_quic_stream_s;
25
26 typedef struct us_quic_socket_context_s us_quic_socket_context_t;
27 typedef struct us_quic_listen_socket_s us_quic_listen_socket_t;
28 typedef struct us_quic_stream_s us_quic_stream_t;
29
30
31 void *us_quic_stream_ext(us_quic_stream_t *s);
32 int us_quic_stream_write(us_quic_stream_t *s, char *data, int length);
33 int us_quic_stream_shutdown(us_quic_stream_t *s);
34 int us_quic_stream_shutdown_read(us_quic_stream_t *s);
35 void us_quic_stream_close(us_quic_stream_t *s);
36
37 int us_quic_socket_context_get_header(us_quic_socket_context_t *context, int index, char **name, int *name_length, char **value, int *value_length);
38
39
40 void us_quic_socket_context_set_header(us_quic_socket_context_t *context, int index, const char *key, int key_length, const char *value, int value_length);
41 void us_quic_socket_context_send_headers(us_quic_socket_context_t *context, us_quic_stream_t *s, int num, int has_body);
42
43us_quic_socket_context_t *us_create_quic_socket_context(struct us_loop_t *loop, us_quic_socket_context_options_t options, int ext_size);
44us_quic_listen_socket_t *us_quic_socket_context_listen(us_quic_socket_context_t *context, const char *host, int port, int ext_size);
45us_quic_socket_t *us_quic_socket_context_connect(us_quic_socket_context_t *context, const char *host, int port, int ext_size);
46
47 void us_quic_socket_create_stream(us_quic_socket_t *s, int ext_size);
48us_quic_socket_t *us_quic_stream_socket(us_quic_stream_t *s);
49
50/* This one is ugly and is only used to make clean examples */
51 int us_quic_stream_is_client(us_quic_stream_t *s);
52
53 void us_quic_socket_context_on_stream_data(us_quic_socket_context_t *context, void(*on_stream_data)(us_quic_stream_t *s, char *data, int length));
54 void us_quic_socket_context_on_stream_end(us_quic_socket_context_t *context, void(*on_stream_data)(us_quic_stream_t *s));
55 void us_quic_socket_context_on_stream_headers(us_quic_socket_context_t *context, void(*on_stream_headers)(us_quic_stream_t *s));
56 void us_quic_socket_context_on_stream_open(us_quic_socket_context_t *context, void(*on_stream_open)(us_quic_stream_t *s, int is_client));
57 void us_quic_socket_context_on_stream_close(us_quic_socket_context_t *context, void(*on_stream_close)(us_quic_stream_t *s));
58 void us_quic_socket_context_on_open(us_quic_socket_context_t *context, void(*on_open)(us_quic_socket_t *s, int is_client));
59 void us_quic_socket_context_on_close(us_quic_socket_context_t *context, void(*on_close)(us_quic_socket_t *s));
60 void us_quic_socket_context_on_stream_writable(us_quic_socket_context_t *context, void(*on_stream_writable)(us_quic_stream_t *s));
61
62
63
64 void *us_quic_socket_context_ext(us_quic_socket_context_t *context);
65us_quic_socket_context_t *us_quic_socket_context(us_quic_socket_t *s);
66
67#endif
68#endif
libusockets.h
us_loop_t
Definition asio.h:26