What a protocol needs to route messages around. More...
#include <protocols.h>
Public Attributes | |
| guint | id |
| Useful for broadcasts. | |
| struct protocol ** | global |
| Reference to the global variable that references this protocol. | |
| void(* | init )() |
| Sets up the protocol to run. | |
| enum protocol_handles(* | handles )(struct client *client) |
| Function that determines if the protocol can handle the client. More... | |
| enum protocol_status(* | handshake )(struct client *client) |
| Completes the handshake with the client. More... | |
| enum protocol_status(* | route )(struct client *client, gsize *used) |
| Reads and routes data available on the client. | |
| void(* | heartbeat )(struct client *client, const struct protocol_heartbeat *hb) |
| Send a heartbeat to a client, if necessary. | |
| 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(). | |
| void(* | send )(struct client *client, const struct protocol_frames *frames) |
| Send a frame to a client. | |
| void(* | close )(struct client *client, guint reason) |
| Sends a final farewell message to clients before they close. | |
What a protocol needs to route messages around.
| enum protocol_handles(* protocol::handles)(struct client *client) |
Function that determines if the protocol can handle the client.
| client | The client that we're checking |
| enum protocol_status(* protocol::handshake)(struct client *client) |
Completes the handshake with the client.
Once a protocol has accepted a client, this function will be called instead of route until PROT_OK is returned or the client is killed.
| client | The client to handshake with |
1.8.6