QuickIO  0.2
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
protocols_http.h
Go to the documentation of this file.
1 
12 #pragma once
13 #include "quickio.h"
14 
18 #define HTTP_NOCACHE \
19  "Cache-Control: private, max-age=0\r\n" \
20  "Expires: -1\r\n"
21 
25 #define HTTP_COMMON \
26  HTTP_NOCACHE \
27  "Connection: Keep-Alive\r\n" \
28  "Keep-Alive: timeout=60\r\n"
29 
37  HTTP_DONE = 2000,
38 
43 
48 
53 };
54 
59 
63 void protocol_http_init();
64 
69 
73 enum protocol_status protocol_http_route(struct client *client, gsize *used);
74 
79  struct client *client,
80  const struct protocol_heartbeat *hb);
81 
89  const gchar *ev_path,
90  const gchar *ev_extra,
91  const evs_cb_t server_cb,
92  const gchar *json);
93 
99  struct client *client,
100  const struct protocol_frames *pframes);
101 
105 void protocol_http_close(struct client *client, guint reason);
No surrogate was found for the client.
Definition: protocols_http.h:42
guint64 evs_cb_t
Callbacks are just gigantic integers, 0 meaning "no callback".
Definition: evs.h:23
Useful information about heartbeat timings.
Definition: protocols.h:64
http_close_reasons
Extends the reasons for closing a client.
Definition: protocols_http.h:33
void protocol_http_close(struct client *client, guint reason)
Terminates all communications with the client.
void protocol_http_init()
Sets up everything to run.
enum protocol_handles protocol_http_handles(struct client *client)
If the client really wants to HTTP Poll.
Client closed according to the HTTP standard.
Definition: protocols_http.h:37
protocol_handles
If a protocol can handle a client.
Definition: protocols.h:23
void protocol_http_send(struct client *client, const struct protocol_frames *pframes)
HTTP uses surrogates, so it has its own sending mechanisms to make sure messages are routed to the ri...
Sometimes was woefully wrong with the request.
Definition: protocols_http.h:47
struct protocol_frames protocol_http_frame(const gchar *ev_path, const gchar *ev_extra, const evs_cb_t server_cb, const gchar *json)
Frames data to send out to a client.
Everything that a client needs to function.
Definition: client.h:100
What a protocol needs to route messages around.
Definition: protocols.h:114
struct protocol * protocol_http
This protocol's functions.
Definition: protocols_http.h:58
Every header, definition, and whatnot QuickIO needs to run.
Client didn't send length.
Definition: protocols_http.h:52
protocol_status
Responses from the route() functions.
Definition: protocols.h:43
void protocol_http_heartbeat(struct client *client, const struct protocol_heartbeat *hb)
Sends a heartbeat to a client.
enum protocol_status protocol_http_route(struct client *client, gsize *used)
Routes the data received from a client.
Some protocols (HTTP, looking at you) need a few frames types depending on the type of client they're...
Definition: protocols.h:99