QuickIO  0.2
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Enumerations | Functions | Variables
protocols_raw.h File Reference

Allows communication with QIO without any framing. More...

#include "quickio.h"

Go to the source code of this file.

Enumerations

enum  raw_close_reasons { RAW_INVALID_EVENT_FORMAT = 1000, RAW_HEARTATTACK }
 Extends the reasons for closing a client. More...
 
enum  protocol_raw_hb { protocol_raw_hb_none, protocol_raw_hb_heartbeat, protocol_raw_hb_challenge }
 The type of heartbeat to send.
 

Functions

void protocol_raw_init ()
 Sets up everything to run.
 
enum protocol_handles protocol_raw_handles (struct client *client)
 If flash can handle this client.
 
enum protocol_status protocol_raw_handshake (struct client *client)
 To complete the single, simple flash handshake.
 
enum protocol_status protocol_raw_route (struct client *client, gsize *used)
 Routes the data received from a client.
 
void protocol_raw_heartbeat (struct client *client, const struct protocol_heartbeat *hb)
 Sends a heartbeat to a client.
 
struct protocol_frames protocol_raw_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. More...
 
GString * protocol_raw_format (const gchar *ev_path, const gchar *ev_extra, const evs_cb_t server_cb, const gchar *json)
 Formats an event into the QIO protocol. More...
 
gboolean protocol_raw_check_handshake (struct client *client)
 Checks that the data received is indeed a valid QIO handshake.
 
void protocol_raw_do_heartbeat (struct client *client, const struct protocol_heartbeat *hb, const gchar *heartbeat, const gsize heartbeat_len)
 Checks that the data received is indeed a valid QIO handshake.
 
enum protocol_status protocol_raw_handle (struct client *client, gchar *event)
 Handles a raw frame from a client. More...
 

Variables

struct protocolprotocol_raw
 This protocol's functions.
 

Detailed Description

Allows communication with QIO without any framing.

In other words, plain text using the QIO protocol.

Author
Andrew Stone andre.nosp@m.w@cl.nosp@m.ovar..nosp@m.com

Enumeration Type Documentation

Extends the reasons for closing a client.

Enumerator
RAW_INVALID_EVENT_FORMAT 

The event was improperly formatted.

RAW_HEARTATTACK 

Heartbeating the client failed, and he's now dead.

(In other words, client is probably closed because there was no response from him when a heartbeat challenge was sent.)

Function Documentation

GString* protocol_raw_format ( const gchar *  ev_path,
const gchar *  ev_extra,
const evs_cb_t  server_cb,
const gchar *  json 
)

Formats an event into the QIO protocol.

Parameters
ev_pathObviously the path
ev_extraExtra path segments
server_cbThe callback the server expects
jsonData to send
Returns
A buffer containing the formatted event. [transfer-full]
struct protocol_frames protocol_raw_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.

Returns
A buffer containing the frame. [transfer-full]
enum protocol_status protocol_raw_handle ( struct client client,
gchar *  event 
)

Handles a raw frame from a client.

Parameters
clientThe client that sent the event
eventThe raw event from the client. MUST be NULL-terminated.