18 #define PROTOCOLS_HEARTBEAT "/qio/heartbeat:0=null"
163 const gchar *ev_path,
164 const gchar *ev_extra,
218 const gchar *ev_path,
219 const gchar *ev_extra,
guint64 evs_cb_t
Callbacks are just gigantic integers, 0 meaning "no callback".
Definition: evs.h:23
struct protocol * prot
Once a protocol has accepted the client, this will point to the protocol-level functions that can be ...
Definition: client.h:119
Useful information about heartbeat timings.
Definition: protocols.h:64
GString * def
The default frame.
Definition: protocols.h:103
gint64 heartbeat
If client->last_send is less than this, needs a simple heartbeat sent.
Definition: protocols.h:81
void protocols_send(struct client *client, const gchar *ev_path, const gchar *ev_extra, const evs_cb_t server_cb, const gchar *json)
Write data out to a client, properly framing it as the protocol requires.
void protocols_heartbeat(struct client *client, const struct protocol_heartbeat *hb)
Run any necessary heartbeating on the given client.
Message was handled and routed correctly.
Definition: protocols.h:47
void protocols_route(struct client *client)
Route a message from a client to the correct protocol handler.
struct client * client
Can be 1 of 3 things, depending on client type: 1) If the client is a surrogate, then points to the c...
Definition: client.h:224
Can definitely handle the client.
Definition: protocols.h:27
void protocols_closed(struct client *client, guint reason)
Notification that a client was closed.
guint id
Useful for broadcasts.
Definition: protocols.h:118
protocol_handles
If a protocol can handle a client.
Definition: protocols.h:23
enum protocol_status(* handshake)(struct client *client)
Completes the handshake with the client.
Definition: protocols.h:146
enum protocol_handles(* handles)(struct client *client)
Function that determines if the protocol can handle the client.
Definition: protocols.h:136
struct protocol_frames * protocols_bcast(const gchar *ev_path, const gchar *json)
Get an array of framed events, one for each protocol.
struct protocol ** global
Reference to the global variable that references this protocol.
Definition: protocols.h:123
gint64 dead
If client->last_recv is less than this, the client is just dead.
Definition: protocols.h:91
struct client * protocols_new_surrogate(struct protocol *prot)
Create a new surrogate client bound to the given protocol.
The client was killed by the protocol and will not be handled.
Definition: protocols.h:58
void(* send)(struct client *client, const struct protocol_frames *frames)
Send a frame to a client.
Definition: protocols.h:171
enum protocol_status(* route)(struct client *client, gsize *used)
Reads and routes data available on the client.
Definition: protocols.h:151
Everything that a client needs to function.
Definition: client.h:100
void protocols_init()
Setup all protocols and get ready to run.
Definitely cannot handle the client.
Definition: protocols.h:37
void protocols_switch(struct client *client, struct protocol *prot)
Switch a client to a different protocol.
What a protocol needs to route messages around.
Definition: protocols.h:114
void protocols_bcast_free(struct protocol_frames *frames)
Frees up the frames allocated by protocols_bcast().
gint64 challenge
If client->last_recv is less than this, needs a hearbeat challenge.
Definition: protocols.h:86
void(* heartbeat)(struct client *client, const struct protocol_heartbeat *hb)
Send a heartbeat to a client, if necessary.
Definition: protocols.h:156
void(* init)()
Sets up the protocol to run.
Definition: protocols.h:128
Every header, definition, and whatnot QuickIO needs to run.
struct protocol_heartbeat protocols_heartbeat_get_intervals()
Get the heartbeat intervals that should be used in this round of periodic tasks.
gint64 poll
If client->last_send is less than this, the poll should be completed so that a new iteration can be s...
Definition: protocols.h:76
struct protocol_frames(* frame)(const gchar *ev_path, const gchar *ev_extra, const evs_cb_t server_cb, const gchar *json)
Frames the data in whatever the protocol dictates such that it can be directly written via qev_write(...
Definition: protocols.h:162
protocol_status
Responses from the route() functions.
Definition: protocols.h:43
gint64 timeout
If client->last_send is less than this, then the client can be considered as timed out of the protoco...
Definition: protocols.h:70
void protocols_bcast_write(struct client *client, const struct protocol_frames *frames)
Writes the broadcast to the given client.
void(* close)(struct client *client, guint reason)
Sends a final farewell message to clients before they close.
Definition: protocols.h:176
Message has not been completely delivered yet, try again with more data.
Definition: protocols.h:53
Might be able to handle the client, need more data to see.
Definition: protocols.h:32
GString * raw
A raw frame.
Definition: protocols.h:108
Some protocols (HTTP, looking at you) need a few frames types depending on the type of client they're...
Definition: protocols.h:99